diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbTests.cs index bcfa9cbd31..d28207037d 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbTests.cs @@ -16,7 +16,7 @@ public class PrefetchVerbTests : TestsWithEnlistmentPerFixture private FileSystemRunner fileSystem; - public PrefetchVerbTests() + public PrefetchVerbTests() : base(skipPrefetchDuringClone: true) { this.fileSystem = new SystemIORunner(); } @@ -133,11 +133,12 @@ private void PostFetchJobShouldComplete() // Wait first, to hopefully ensure the background thread has // started before we check for the lock file. + int timeoutCount = 0; do { Thread.Sleep(500); } - while (this.fileSystem.FileExists(postFetchLock)); + while (this.fileSystem.FileExists(postFetchLock) && ++timeoutCount < 100); ProcessResult midxResult = GitProcess.InvokeProcess(this.Enlistment.RepoRoot, "midx --read --pack-dir=\"" + objectDir + "/pack\""); midxResult.ExitCode.ShouldEqual(0); diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbWithoutSharedCacheTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbWithoutSharedCacheTests.cs index dc573be9f5..d5d12249b8 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbWithoutSharedCacheTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbWithoutSharedCacheTests.cs @@ -373,10 +373,12 @@ private void PostFetchJobShouldComplete() string objectDir = this.Enlistment.GetObjectRoot(this.fileSystem); string postFetchLock = Path.Combine(objectDir, "post-fetch.lock"); - while (this.fileSystem.FileExists(postFetchLock)) + int timeoutCount = 0; + do { Thread.Sleep(500); } + while (this.fileSystem.FileExists(postFetchLock) && ++timeoutCount < 100); ProcessResult midxResult = GitProcess.InvokeProcess(this.Enlistment.RepoRoot, "midx --read --pack-dir=\"" + objectDir + "/pack\""); midxResult.ExitCode.ShouldEqual(0); diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/TestsWithEnlistmentPerFixture.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/TestsWithEnlistmentPerFixture.cs index fd5d798fde..4c129aef6f 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/TestsWithEnlistmentPerFixture.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/TestsWithEnlistmentPerFixture.cs @@ -29,7 +29,7 @@ public virtual void CreateEnlistment() } else { - this.Enlistment = GVFSFunctionalTestEnlistment.CloneAndMount(GVFSTestConfig.PathToGVFS); + this.Enlistment = GVFSFunctionalTestEnlistment.CloneAndMount(GVFSTestConfig.PathToGVFS, skipPrefetch: this.skipPrefetchDuringClone); } }