Skip to content

Commit 2f8b056

Browse files
authored
test(agent/agentcontainers): fix test data race due to list manipulation (#18250)
Fixes coder/internal#675
1 parent 2c0c58a commit 2f8b056

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

agent/agentcontainers/api.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,8 @@ func (api *API) updateContainers(ctx context.Context) error {
378378

379379
return xerrors.Errorf("list containers failed: %w", err)
380380
}
381+
// Clone to avoid test flakes due to data manipulation.
382+
updated.Containers = slices.Clone(updated.Containers)
381383

382384
api.mu.Lock()
383385
defer api.mu.Unlock()

0 commit comments

Comments
 (0)