mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
test(agent/agentcontainers): fix test data race due to list manipulation (#18250)
Fixes coder/internal#675
This commit is contained in:
@@ -378,6 +378,8 @@ func (api *API) updateContainers(ctx context.Context) error {
|
||||
|
||||
return xerrors.Errorf("list containers failed: %w", err)
|
||||
}
|
||||
// Clone to avoid test flakes due to data manipulation.
|
||||
updated.Containers = slices.Clone(updated.Containers)
|
||||
|
||||
api.mu.Lock()
|
||||
defer api.mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user