diff --git a/coderd/chatd/chatd_test.go b/coderd/chatd/chatd_test.go index de603b1a3e..9b7d9ef2a9 100644 --- a/coderd/chatd/chatd_test.go +++ b/coderd/chatd/chatd_test.go @@ -1268,35 +1268,35 @@ func TestInterruptChatDoesNotSendWebPushNotification(t *testing.T) { require.NoError(t, err) // Wait for the chat to be picked up and start streaming. - require.Eventually(t, func() bool { + testutil.Eventually(ctx, t, func(ctx context.Context) bool { fromDB, dbErr := db.GetChatByID(ctx, chat.ID) if dbErr != nil { return false } return fromDB.Status == database.ChatStatusRunning && fromDB.WorkerID.Valid - }, testutil.WaitMedium, testutil.IntervalFast) + }, testutil.IntervalFast) - require.Eventually(t, func() bool { + testutil.Eventually(ctx, t, func(ctx context.Context) bool { select { case <-streamStarted: return true default: return false } - }, testutil.WaitMedium, testutil.IntervalFast) + }, testutil.IntervalFast) // Interrupt the chat. updated := server.InterruptChat(ctx, chat) require.Equal(t, database.ChatStatusWaiting, updated.Status) // Wait for the chat to finish processing and return to waiting. - require.Eventually(t, func() bool { + testutil.Eventually(ctx, t, func(ctx context.Context) bool { fromDB, dbErr := db.GetChatByID(ctx, chat.ID) if dbErr != nil { return false } return fromDB.Status == database.ChatStatusWaiting && !fromDB.WorkerID.Valid - }, testutil.WaitMedium, testutil.IntervalFast) + }, testutil.IntervalFast) // Verify no web push notification was dispatched. require.Equal(t, int32(0), mockPush.dispatchCount.Load(),