mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: fix flake in TestResponsesInjectedTool (#25630)
Fixes flake in TestResponsesInjectedTool. See https://github.com/coder/coder/pull/25630/changes/d9bfeb20092129127ad5e7958c5b8dbf46740527 for reproduction. Due to AsyncRecorded token usages may be recorded in different order then expected. Fixes: https://github.com/coder/internal/issues/1544
This commit is contained in:
@@ -920,7 +920,12 @@ func TestResponsesInjectedTool(t *testing.T) {
|
||||
for i := range tokenUsages {
|
||||
tokenUsages[i].InterceptionID = "" // ignore interception ID and time creation when comparing
|
||||
tokenUsages[i].CreatedAt = time.Time{}
|
||||
require.Equal(t, tc.expectTokenUsages[i], *tokenUsages[i])
|
||||
}
|
||||
|
||||
// Match by content, not position, AsyncRecorder may flake.
|
||||
// See https://github.com/coder/internal/issues/1544.
|
||||
for _, expected := range tc.expectTokenUsages {
|
||||
require.Contains(t, tokenUsages, &expected)
|
||||
}
|
||||
|
||||
// Verify the response is the final tool response (after agentic loop).
|
||||
|
||||
Reference in New Issue
Block a user