-
Notifications
You must be signed in to change notification settings - Fork 2.1k
ci: Don't install dependencies in tests that don't need it #11071
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
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a90088f
ci: Share an npm cache for fixtures
anthonyshew 25a6b6b
WIP ca008
anthonyshew 7dd8cc5
WIP aef36
anthonyshew 9a6135d
reset to main
anthonyshew 2a64c81
WIP 98089
anthonyshew 59bf576
do it for more
anthonyshew e78b5a5
WIP f169b
anthonyshew File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Race condition: Multiple parallel test processes can simultaneously check for the fixture cache, find it doesn't exist, and both attempt to create and populate it, causing corruption or conflicts in the shared cache.
View Details
📝 Patch Details
Analysis
Race condition in fixture cache creation during parallel test execution
What fails: When multiple test processes run in parallel (using
pytest -n autoor similar), they can simultaneously check if the shared fixture cache exists, both find it missing, and proceed to create and populate it concurrently. This causes file conflicts during cache setup and corrupts the shared node_modules cache.How to reproduce:
cd turborepo-tests/integration npm run pretest:parallel npm run test:parallelWith timing conditions, multiple concurrent tests will detect the same fixture cache (
/tmp/turbo-fixture-cache/[email protected]) doesn't exist and attempt simultaneous:mkdir -pandcopy_fixture.shoperations on the same directorynpm installin the same cache directoryResult: Incomplete or corrupted node_modules, failed dependency installations, and test failures that are difficult to reproduce (timing-dependent).
Expected behavior: Only the first process should create and populate the cache; others should wait for it to complete before using it.
Solution implemented: Added file-level locking using:
flockwhen available (Linux/systems with util-linux)mkdirfor lock directory whenflockis unavailable (macOS compatibility)This ensures only one process at a time creates and populates each shared fixture cache.