Skip to content
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
9 changes: 2 additions & 7 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading