Skip to content

feat(testutil): add testutil.IsParallel() #14418

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

Closed
wants to merge 2 commits into from
Closed

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Aug 23, 2024

Follow-up from #14414
Adds a test helper to detect if the current test is running in parallel.
Adds this to coderdtest.New where we were previously silently mutating DeploymentValues.

@johnstcn johnstcn self-assigned this Aug 23, 2024
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Neat hack, thought we might use reflect but this is pretty nice.

This won't guard against t.Parallel() being called later, though.

How about a cleanup function that checks that the test never became parallel and warns/panics if it did?

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

👍

@johnstcn
Copy link
Member Author

OK, so my original idea wasn't strictly correct -- parallel usage is not what we're looking for. See #14417 for the actual 'correct' fix.
I'm going to leave this un-merged for the moment but we can revisit later if it becomes necessary.

@johnstcn johnstcn closed this Aug 23, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 23, 2024
@github-actions github-actions bot deleted the cj/detect-parallel-test branch February 24, 2025 00:07
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.

4 participants