make mongo tests safer to run in parallel#5707
Merged
cognifloyd merged 1 commit intomasterfrom Aug 25, 2022
Merged
Conversation
2b94665 to
4f78668
Compare
4f78668 to
dc657f0
Compare
3c7162c to
a03fbc8
Compare
a03fbc8 to
cbc8af8
Compare
pants runs each test file separately in pytest. So, if two files try to modify the same database at the same time, we'll get strange results. So, modify the db name to ensure that they are safe in parallel.
cbc8af8 to
5236a33
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
I'm working towards introducing
pants. Eventually I would like to use pants to run tests to take advantage of the fine-grained per-file caching of results that accounts for dependencies by python files (pants infers the deps by reading the python files).pants runs each test file separately in pytest. So, if two files try to modify the same database at the same time, we'll get strange results.
Overview
So, modify the db name for each parallel test to ensure that they can run safely in parallel.
Once we integrate pants, we will configure (in pants.toml)
[pytest].execution_slot_var = "ST2TESTS_PARALLEL_SLOT"to take advantage of the env var introduced here.https://www.pantsbuild.org/docs/reference-pytest#section-execution-slot-var