diff --git a/pkg/source/source_integration_test.go b/pkg/source/source_integration_test.go index b3041ec3f4..4c0de6d0b3 100644 --- a/pkg/source/source_integration_test.go +++ b/pkg/source/source_integration_test.go @@ -39,6 +39,8 @@ import ( var _ = Describe("Source", func() { var instance1, instance2 source.Source var obj client.Object + var q workqueue.RateLimitingInterface + var c1, c2 chan interface{} var ns string count := 0 @@ -50,6 +52,10 @@ var _ = Describe("Source", func() { ObjectMeta: metav1.ObjectMeta{Name: ns}, }, metav1.CreateOptions{}) Expect(err).NotTo(HaveOccurred()) + + q = workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "test") + c1 = make(chan interface{}) + c2 = make(chan interface{}) }) JustBeforeEach(func() { @@ -60,6 +66,8 @@ var _ = Describe("Source", func() { AfterEach(func() { err := clientset.CoreV1().Namespaces().Delete(ctx, ns, metav1.DeleteOptions{}) Expect(err).NotTo(HaveOccurred()) + close(c1) + close(c2) }) Describe("Kind", func() { @@ -67,12 +75,6 @@ var _ = Describe("Source", func() { obj = &appsv1.Deployment{} It("should provide Deployment Events", func() { - q := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "test") - c1 := make(chan interface{}) - c2 := make(chan interface{}) - defer close(c1) - defer close(c2) - var created, updated, deleted *appsv1.Deployment var err error @@ -189,12 +191,6 @@ var _ = Describe("Source", func() { }) It("should not get events after stopped", func() { - q := workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "test") - c1 := make(chan interface{}) - c2 := make(chan interface{}) - defer close(c1) - defer close(c2) - var created, updated *appsv1.Deployment var err error