Skip to content

Commit

Permalink
Merge pull request #203 Register repo when cloning and remove mount a…
Browse files Browse the repository at this point in the history
…nd unmount

Register repo when cloning and remove mount and unmount
  • Loading branch information
wilbaker authored Oct 30, 2019
2 parents 872b0d6 + e0c16fb commit f1e7fce
Show file tree
Hide file tree
Showing 29 changed files with 146 additions and 1,550 deletions.
71 changes: 0 additions & 71 deletions Scalar.FunctionalTests/Tests/DiskLayoutVersionTests.cs

This file was deleted.

25 changes: 7 additions & 18 deletions Scalar.FunctionalTests/Tests/EnlistmentPerFixture/CloneTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,11 @@ public class CloneTests : TestsWithEnlistmentPerFixture
private const int ScalarGenericError = 3;

[TestCase]
public void CloneInsideMountedEnlistment()
public void CloneInsideExistingEnlistment()
{
this.SubfolderCloneShouldFail();
}

[TestCase]
public void CloneInsideUnmountedEnlistment()
{
this.Enlistment.UnmountScalar();
this.SubfolderCloneShouldFail();
this.Enlistment.MountScalar();
}

[TestCase]
public void CloneWithLocalCachePathWithinSrc()
{
Expand All @@ -53,20 +45,19 @@ public void SparseCloneWithNoFetchOfCommitsAndTreesSucceeds()

try
{
enlistment = ScalarFunctionalTestEnlistment.CloneAndMountWithPerRepoCache(ScalarTestConfig.PathToScalar, skipFetchCommitsAndTrees: true);
enlistment = ScalarFunctionalTestEnlistment.CloneWithPerRepoCache(ScalarTestConfig.PathToScalar, skipFetchCommitsAndTrees: true);

ProcessResult result = GitProcess.InvokeProcess(enlistment.RepoRoot, "status");
result.ExitCode.ShouldEqual(0, result.Errors);
}
finally
{
enlistment?.UnmountAndDeleteAll();
enlistment?.DeleteAll();
}
}

[TestCase]
[Category(Categories.MacOnly)]
[Category(Categories.NeedsUpdatesForNonVirtualizedMode)]
public void CloneWithDefaultLocalCacheLocation()
{
FileSystemRunner fileSystem = FileSystemRunner.DefaultRunner;
Expand All @@ -77,8 +68,6 @@ public void CloneWithDefaultLocalCacheLocation()

ProcessStartInfo processInfo = new ProcessStartInfo(ScalarTestConfig.PathToScalar);

// Needs update for non-virtualized mode: this used to have --no-mount to avoid an issue
// with registering the mount with the service.
processInfo.Arguments = $"clone {Properties.Settings.Default.RepoToClone} {newEnlistmentRoot} --no-fetch-commits-and-trees";
processInfo.WindowStyle = ProcessWindowStyle.Hidden;
processInfo.CreateNoWindow = true;
Expand All @@ -102,14 +91,14 @@ public void CloneWithDefaultLocalCacheLocation()
[TestCase]
public void CloneToPathWithSpaces()
{
ScalarFunctionalTestEnlistment enlistment = ScalarFunctionalTestEnlistment.CloneAndMountEnlistmentWithSpacesInPath(ScalarTestConfig.PathToScalar);
enlistment.UnmountAndDeleteAll();
ScalarFunctionalTestEnlistment enlistment = ScalarFunctionalTestEnlistment.CloneEnlistmentWithSpacesInPath(ScalarTestConfig.PathToScalar);
enlistment.DeleteAll();
}

[TestCase]
public void CloneCreatesCorrectFilesInRoot()
{
ScalarFunctionalTestEnlistment enlistment = ScalarFunctionalTestEnlistment.CloneAndMount(ScalarTestConfig.PathToScalar);
ScalarFunctionalTestEnlistment enlistment = ScalarFunctionalTestEnlistment.Clone(ScalarTestConfig.PathToScalar);
try
{
Directory.GetFiles(enlistment.EnlistmentRoot).ShouldBeEmpty("There should be no files in the enlistment root after cloning");
Expand All @@ -120,7 +109,7 @@ public void CloneCreatesCorrectFilesInRoot()
}
finally
{
enlistment.UnmountAndDeleteAll();
enlistment.DeleteAll();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void FetchCommitsAndTreesCleansUpBadPrefetchPack()
[TestCase, Order(4)]
public void FetchCommitsAndTreesCleansUpOldPrefetchPack()
{
this.Enlistment.UnmountScalar();
this.Enlistment.UnregisterRepo();

string[] prefetchPacks = this.ReadPrefetchPackFileNames();
long oldestPackTimestamp = this.GetOldestPackTimestamp(prefetchPacks);
Expand Down Expand Up @@ -135,7 +135,7 @@ public void FetchCommitsAndTreesCleansUpOldPrefetchPack()
[Category(Categories.MacTODO.TestNeedsToLockFile)]
public void FetchCommitsAndTreesFailsWhenItCannotRemoveABadPrefetchPack()
{
this.Enlistment.UnmountScalar();
this.Enlistment.UnregisterRepo();

string[] prefetchPacks = this.ReadPrefetchPackFileNames();
long mostRecentPackTimestamp = this.GetMostRecentPackTimestamp(prefetchPacks);
Expand Down Expand Up @@ -168,7 +168,7 @@ public void FetchCommitsAndTreesFailsWhenItCannotRemoveABadPrefetchPack()
[Category(Categories.MacTODO.TestNeedsToLockFile)]
public void FetchCommitsAndTreesFailsWhenItCannotRemoveAPrefetchPackNewerThanBadPrefetchPack()
{
this.Enlistment.UnmountScalar();
this.Enlistment.UnregisterRepo();

string[] prefetchPacks = this.ReadPrefetchPackFileNames();
long oldestPackTimestamp = this.GetOldestPackTimestamp(prefetchPacks);
Expand Down Expand Up @@ -202,7 +202,7 @@ public void FetchCommitsAndTreesFailsWhenItCannotRemoveAPrefetchPackNewerThanBad
[Category(Categories.MacTODO.TestNeedsToLockFile)]
public void FetchCommitsAndTreesFailsWhenItCannotRemoveAPrefetchIdxNewerThanBadPrefetchPack()
{
this.Enlistment.UnmountScalar();
this.Enlistment.UnregisterRepo();

string[] prefetchPacks = this.ReadPrefetchPackFileNames();
long oldestPackTimestamp = this.GetOldestPackTimestamp(prefetchPacks);
Expand Down Expand Up @@ -239,7 +239,7 @@ public void FetchCommitsAndTreesFailsWhenItCannotRemoveAPrefetchIdxNewerThanBadP
[TestCase, Order(8)]
public void FetchCommitsAndTreesCleansUpStaleTempPrefetchPacks()
{
this.Enlistment.UnmountScalar();
this.Enlistment.UnregisterRepo();

// Create stale packs and idxs in the temp folder
string stalePackContents = "StalePack";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public LooseObjectStepTests()
[Order(1)]
public void NoLooseObjectsDoesNothing()
{
this.Enlistment.UnmountScalar();
this.Enlistment.UnregisterRepo();
this.DeleteFiles(this.GetLooseObjectFiles());

this.DeleteFiles(this.GetLooseObjectFiles());
Expand Down Expand Up @@ -133,7 +133,7 @@ public void CorruptLooseObjectIsDeleted()

private void ClearAllObjects()
{
this.Enlistment.UnmountScalar();
this.Enlistment.UnregisterRepo();

// Delete/Move any starting loose objects and packfiles
this.DeleteFiles(this.GetLooseObjectFiles());
Expand Down
Loading

0 comments on commit f1e7fce

Please sign in to comment.