GitStatusCache: fix race condition in test setup #172
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.
Issue
The following functional test run failed with the following logs from build 18226.25:
Looking at the logs, this test attempted to delete the on disk status cache file before the status cache generation was run. The test assumed that at least the directory containing the status cache file existed before this point. Usually this is the case, but if this logic loses the race with the background status (the status cache directory is usually created just before running the actual git command to generate the status cache), then it will fail.
Fix
The test setup waits for the initial status cache to be generated, so it can proceed from a known state. Waiting for the system to settle down and start from a known state ensures it can handle cases where the status cache is in the middle of being generated, and not cause intermittent test issues later on.
Related issue: #170