Skip to content

test(agent/agentcontainers): fix test data race due to list manipulation #18250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Jun 5, 2025

@@ -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)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Perhaps not ideal, but I rather fix it here than in all the tests.

@mafredri mafredri requested review from johnstcn and hugodutka June 5, 2025 14:43
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rust rewrite wen 🙃

@mafredri
Copy link
Member Author

mafredri commented Jun 5, 2025

rust rewrite wen 🙃

Yes. But also no need, this can be refactored in coder/internal#666 where we no longer need to manipulate the data.

@mafredri mafredri enabled auto-merge (squash) June 5, 2025 14:47
@mafredri mafredri merged commit 2f8b056 into main Jun 5, 2025
36 checks passed
@mafredri mafredri deleted the mafredri/test-fix-agent-agentcontainers-list-race-flake branch June 5, 2025 14:53
@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

data race in agent/agentcontainers: processUpdatedContainersLocked
2 participants