Skip to content
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

Improve concurrency safety when tests share a blueprint #864

Merged

Conversation

chrismarget-j
Copy link
Collaborator

@chrismarget-j chrismarget-j commented Sep 21, 2024

The MakeOrFindBlueprint() function had a race condition:

  1. Test A checks for blueprint, gets 404.
  2. Test B checks for blueprint, gets 404.
  3. Test A creates blueprint
  4. TestB creates blueprint, gets error: "already exists"

This PR introduces TestMain() which creates a global sync.Mutex used to control access to the shared blueprint.

Closes #853

@chrismarget-j chrismarget-j linked an issue Sep 21, 2024 that may be closed by this pull request
@chrismarget-j chrismarget-j merged commit 7f85403 into main Sep 25, 2024
1 check passed
@chrismarget-j chrismarget-j deleted the 853-makeorfindblueprint-is-not-concurrency-safe-probably branch September 25, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MakeOrFindBlueprint() is not concurrency safe (probably)
2 participants