From f006890aa296f09c86a8ec59e8adf6c65f424695 Mon Sep 17 00:00:00 2001 From: dprotaso Date: Fri, 21 Jun 2024 15:07:49 -0400 Subject: [PATCH] [logstream] test polling should use a different context --- test/logstream/v2/stream_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/logstream/v2/stream_test.go b/test/logstream/v2/stream_test.go index 2bc05f6b3..d7d63b627 100644 --- a/test/logstream/v2/stream_test.go +++ b/test/logstream/v2/stream_test.go @@ -304,8 +304,9 @@ func TestNamespaceStream(t *testing.T) { // We can't assume that the cancel signal doesn't race the pod creation signal, so // we retry a few times to give some leeway. - if err := wait.PollUntilContextTimeout(ctx, 10*time.Millisecond, time.Second, true, func(ctx context.Context) (bool, error) { - if _, err := podClient.Create(context.Background(), knativePod, metav1.CreateOptions{}); err != nil { + pollCtx := context.Background() + if err := wait.PollUntilContextTimeout(pollCtx, 10*time.Millisecond, time.Second, true, func(ctx context.Context) (bool, error) { + if _, err := podClient.Create(pollCtx, knativePod, metav1.CreateOptions{}); err != nil { return false, err } @@ -314,7 +315,7 @@ func TestNamespaceStream(t *testing.T) { return true, nil case <-logFuncInvoked: t.Log("Log was still produced, trying again...") - if err := podClient.Delete(context.Background(), knativePod.Name, metav1.DeleteOptions{}); err != nil { + if err := podClient.Delete(pollCtx, knativePod.Name, metav1.DeleteOptions{}); err != nil { return false, err } return false, nil