From d1054d3a6cf7996c656da1dce2552f0d3da702d3 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Mon, 17 Jun 2019 07:20:48 -0400 Subject: [PATCH] PrefetchTests: Unmount before deleting packs If we do not unmount, then the packs do not get deleted and we skip writing the commit-graph due to no new packs, failing the test. Signed-off-by: Derrick Stolee --- .../PrefetchVerbWithoutSharedCacheTests.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbWithoutSharedCacheTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbWithoutSharedCacheTests.cs index 0936de0dc8..b7f110300a 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbWithoutSharedCacheTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbWithoutSharedCacheTests.cs @@ -254,6 +254,8 @@ public void PrefetchFailsWhenItCannotRemoveAPrefetchIdxNewerThanBadPrefetchPack( [TestCase, Order(8)] public void PrefetchCleansUpStaleTempPrefetchPacks() { + this.Enlistment.UnmountGVFS(); + // Create stale packs and idxs in the temp folder string stalePackContents = "StalePack"; string stalePackPath = Path.Combine(this.TempPackRoot, $"{PrefetchPackPrefix}-123456-{Guid.NewGuid().ToString("N")}.pack"); @@ -304,18 +306,24 @@ public void PrefetchCleansUpOphanedLockFiles() this.fileSystem.CreateEmptyFile(graphLockPath); + // Unmount so we can delete the files. + this.Enlistment.UnmountGVFS(); + // Force deleting the prefetch packs to make the prefetch non-trivial. this.fileSystem.DeleteDirectory(this.PackRoot); this.fileSystem.CreateDirectory(this.PackRoot); this.fileSystem.CreateEmptyFile(midxLockPath); + // Re-mount so the post-fetch job runs + this.Enlistment.MountGVFS(); + this.Enlistment.Prefetch("--commits"); this.PostFetchJobShouldComplete(); - this.fileSystem.FileExists(graphLockPath).ShouldBeFalse(); - this.fileSystem.FileExists(midxLockPath).ShouldBeFalse(); - this.fileSystem.FileExists(graphPath).ShouldBeTrue(); - this.fileSystem.FileExists(midxPath).ShouldBeTrue(); + this.fileSystem.FileExists(graphLockPath).ShouldBeFalse(nameof(graphLockPath)); + this.fileSystem.FileExists(midxLockPath).ShouldBeFalse(nameof(midxLockPath)); + this.fileSystem.FileExists(graphPath).ShouldBeTrue(nameof(graphPath)); + this.fileSystem.FileExists(midxPath).ShouldBeTrue(nameof(midxPath)); } private void PackShouldHaveIdxFile(string pathPath)