From d58791ee345b27cbb03d6f9c9e84fdce89877d3d Mon Sep 17 00:00:00 2001 From: Brandur Date: Thu, 16 Jul 2026 18:21:59 -0500 Subject: [PATCH] Fix intermittent test `Test_Client_JobContextInheritsFromProvidedContext` Fix another intermittent test in CI [1]. This one's more a classic problem, with aggressive deadlines assigned to operations that can easily fail in CI. [1] https://github.com/riverqueue/river/actions/runs/29541818855/job/87765453705?pr=1313 --- client_test.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/client_test.go b/client_test.go index 8cae22dd..478ff6eb 100644 --- a/client_test.go +++ b/client_test.go @@ -2804,19 +2804,14 @@ func Test_Client_JobContextInheritsFromProvidedContext(t *testing.T) { ctx = context.WithValue(ctx, customContextKey("BestGoPostgresQueue"), "River") client := runNewTestClient(ctx, t, config) - insertCtx, insertCancel := context.WithTimeout(ctx, time.Second) + insertCtx, insertCancel := context.WithTimeout(ctx, riversharedtest.WaitTimeout()) t.Cleanup(insertCancel) // enqueue job: _, err := client.Insert(insertCtx, callbackWithCustomTimeoutArgs{TimeoutValue: 5 * time.Minute}, nil) require.NoError(t, err) - var jobCtx context.Context - select { - case jobCtx = <-jobCtxCh: - case <-time.After(5 * time.Second): - t.Fatal("timed out waiting for job to start") - } + jobCtx := riversharedtest.WaitOrTimeout(t, jobCtxCh) require.Equal(t, "River", jobCtx.Value(customContextKey("BestGoPostgresQueue")), "job should persist the context value from the client context") jobDeadline, ok := jobCtx.Deadline()