test(coderd/x/chatd): accept query cancellation in subagent wait (#27818)

Closes CODAGT-877
Closes https://github.com/coder/internal/issues/1437

The linked flake happens because the context deadline can be observed as
`context.DeadlineExceeded`, or as a PostgreSQL query cancellation when a
database call is in flight. The fix is just to assert that the deadline
expired and the returned error is a recognised query cancellation,
rather than depending on which layer notices it first.
This commit is contained in:
Ethan
2026-08-05 11:40:00 +10:00
committed by GitHub
parent cb992b35fd
commit 1702bbb816
+2 -1
View File
@@ -4237,7 +4237,8 @@ func TestAwaitSubagentCompletion(t *testing.T) {
_, _, err = server.awaitSubagentCompletion(
shortCtx, parent.ID, child.ID, 5*time.Second,
)
require.ErrorIs(t, err, context.DeadlineExceeded)
require.ErrorIs(t, shortCtx.Err(), context.DeadlineExceeded)
require.True(t, database.IsQueryCanceledError(err))
})
t.Run("ZeroTimeoutUsesDefault", func(t *testing.T) {