make mongo tests safer to run in parallel #5707
Merged
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