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

GitStatusCache: fix race condition in test setup #172

Merged
merged 1 commit into from
Aug 17, 2018

Conversation

jamill
Copy link
Member

@jamill jamill commented Aug 15, 2018

Issue
The following functional test run failed with the following logs from build 18226.25:

System.IO.DirectoryNotFoundException : Could not find a part of the path 'C:\Repos\GVFSFunctionalTests\enlistment\287fdef1a84b4204977e\.gvfs\GitStatusCache\GitStatusCache.dat'.
    at System.IO.FileSystem.DeleteFile(String fullPath)
    at System.IO.File.Delete(String path)
    at GVFS.FunctionalTests.Tests.GitCommands.StatusTests.RepositoryIgnoreTestSetup() in C:\agent\_work\3\s\GVFS\GVFS.FunctionalTests\Tests\GitCommands\StatusTests.cs:line 102
    at GVFS.FunctionalTests.Tests.GitCommands.StatusTests.NewRepositoryExcludeFileInvalidatesCache() in C:\agent\_work\3\s\GVFS\GVFS.FunctionalTests\Tests\GitCommands\StatusTests.cs:line 59

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

@jamill jamill self-assigned this Aug 16, 2018
@jamill jamill added the type: test-reliability Issues that contribute to test failures label Aug 16, 2018
@jrbriggs jrbriggs added this to the M139 milestone Aug 16, 2018
This is to fix an issue that happened (intermittently) in the functional
tests. There is a race condition where the test is attempting to delete
the status cache file, but the status cache might not have been
generated for the test repository.

To fix this, the test setup will wait for the initial status cache to be
generated, so it can proceed from a known state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: test-reliability Issues that contribute to test failures
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants