Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Address proper handling of assync behavior on test #1544

Merged
merged 1 commit into from
Aug 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions pkg/endpoint/providers/kube/client_test.go
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@ package kube
import (
"context"
"net"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -73,10 +72,8 @@ var _ = Describe("Test Kube Client Provider", func() {
fakeClientSet.CoreV1().Endpoints(tests.BookbuyerService.Namespace).
Create(context.TODO(), endp, metav1.CreateOptions{})

// Expect bookbuyer endpoint, async/event listening in Provider makes inmediate calls fail
Eventually(func() []endpoint.Endpoint {
return cli.ListEndpointsForService(tests.BookbuyerService)
}, 2*time.Second).Should(Equal([]endpoint.Endpoint{
<-cli.GetAnnouncementsChannel()
Expect(cli.ListEndpointsForService(tests.BookbuyerService)).To(Equal([]endpoint.Endpoint{
{
IP: net.IPv4(8, 8, 8, 8),
Port: 88,
@@ -134,12 +131,9 @@ var _ = Describe("Test Kube Client Provider", func() {

Expect(err).To(BeNil())

// Expect bookbuyer endpoint, async/event listening in provider makes inmediate calls fail
Eventually(func() service.MeshService {
svcMesh, _ := cli.GetServiceForServiceAccount(tests.BookbuyerServiceAccount)
return svcMesh
}, 2*time.Second).Should(Equal(tests.BookbuyerService))
<-cli.GetAnnouncementsChannel()

Expect(cli.GetServiceForServiceAccount(tests.BookbuyerServiceAccount)).To(Equal(tests.BookbuyerService))
})

It("tests GetAnnouncementChannel", func() {