From 360e119b4381d5698fc97572239b74c49809ca52 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Wed, 22 Apr 2026 09:14:25 +0100 Subject: [PATCH] fix(coderd): use waitChatSettled in remaining title tests (#24585) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace inline `require.Eventually` blocks in `PreservesUpdatedAt` and `NoOpWhenTitleUnchanged` with the shared `waitChatSettled` helper - These were the last two title subtests still using direct DB polling instead of the API-based helper > 🤖 --- coderd/exp_chats_test.go | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/coderd/exp_chats_test.go b/coderd/exp_chats_test.go index b158096a87..b008c0ce09 100644 --- a/coderd/exp_chats_test.go +++ b/coderd/exp_chats_test.go @@ -4412,15 +4412,7 @@ func TestPatchChat(t *testing.T) { _ = createChatModelConfig(t, client) chat := createChat(ctx, t, client, firstUser.OrganizationID, "rename me") - - require.Eventually(t, func() bool { - c, getErr := db.GetChatByID(dbauthz.AsSystemRestricted(ctx), chat.ID) - if getErr != nil { - return false - } - return c.Status != database.ChatStatusPending && - c.Status != database.ChatStatusRunning - }, testutil.WaitShort, testutil.IntervalFast) + waitChatSettled(ctx, t, client, chat.ID) past := time.Now().UTC().Add(-2 * time.Hour).Truncate(time.Second) _, err := sqlDB.ExecContext(ctx, @@ -4455,15 +4447,7 @@ func TestPatchChat(t *testing.T) { _ = createChatModelConfig(t, client) chat := createChat(ctx, t, client, firstUser.OrganizationID, "steady title") - - require.Eventually(t, func() bool { - c, getErr := db.GetChatByID(dbauthz.AsSystemRestricted(ctx), chat.ID) - if getErr != nil { - return false - } - return c.Status != database.ChatStatusPending && - c.Status != database.ChatStatusRunning - }, testutil.WaitShort, testutil.IntervalFast) + waitChatSettled(ctx, t, client, chat.ID) past := time.Now().UTC().Add(-2 * time.Hour).Truncate(time.Second) _, err := sqlDB.ExecContext(ctx,