From e95023b76e7816f8cfe61610c92a5a79b3d4372a Mon Sep 17 00:00:00 2001 From: Sargun Dhillon Date: Wed, 14 Apr 2021 10:51:34 -0700 Subject: [PATCH] Fix test This starts watching for events prior to the start of the controller. This smells like a bug in the fakeclient bits, but it seems to fix the problem. Signed-off-by: Sargun Dhillon --- node/lifecycle_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/node/lifecycle_test.go b/node/lifecycle_test.go index e455117a7..10e187597 100644 --- a/node/lifecycle_test.go +++ b/node/lifecycle_test.go @@ -390,10 +390,7 @@ func testDanglingPodScenarioWithDeletionTimestamp(ctx context.Context, t *testin _, e := s.client.CoreV1().Pods(testNamespace).Create(ctx, podCopyWithDeletionTimestamp, metav1.CreateOptions{}) assert.NilError(t, e) - // Start the pod controller - assert.NilError(t, s.start(ctx)) watchErrCh := make(chan error) - go func() { _, watchErr := watchutils.UntilWithoutRetry(ctx, watcher, func(ev watch.Event) (bool, error) { @@ -402,6 +399,9 @@ func testDanglingPodScenarioWithDeletionTimestamp(ctx context.Context, t *testin watchErrCh <- watchErr }() + // Start the pod controller + assert.NilError(t, s.start(ctx)) + select { case <-ctx.Done(): t.Fatalf("Context ended early: %s", ctx.Err().Error())