mirror of
https://github.com/coder/coder.git
synced 2026-09-22 05:05:20 +08:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user