Skip to content

Commit

Permalink
[WIP] make fetch lock test work on Windows (and only Windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisd8088 committed Sep 3, 2020
1 parent 7083919 commit 00f8ea1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,6 @@ jobs:
run: |
cd ../out
PATH="$PWD/Scalar/$BUILD_FRAGMENT:$PWD/Scalar.Service/$BUILD_FRAGMENT:$PATH"
Scalar.FunctionalTests/$BUILD_FRAGMENT/Scalar.FunctionalTests$BUILD_FILE_EXT --test-scalar-on-path --full-suite
Scalar.FunctionalTests/$BUILD_FRAGMENT/Scalar.FunctionalTests$BUILD_FILE_EXT --test-scalar-on-path --test=Scalar.FunctionalTests.Tests.EnlistmentPerFixture.FetchStepTests
##Scalar.FunctionalTests/$BUILD_FRAGMENT/Scalar.FunctionalTests$BUILD_FILE_EXT --test-scalar-on-path --test=Scalar.FunctionalTests.Tests.EnlistmentPerFixture.FetchStepWithoutSharedCacheTests
##Scalar.FunctionalTests/$BUILD_FRAGMENT/Scalar.FunctionalTests$BUILD_FILE_EXT --test-scalar-on-path --full-suite
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Scalar.FunctionalTests.Tests.EnlistmentPerFixture
{
[TestFixture]
[Category(Categories.ExtraCoverage)]
//[Category(Categories.ExtraCoverage)]
public class FetchStepWithoutSharedCacheTests : TestsWithEnlistmentPerFixture
{
private const string PrefetchPackPrefix = "prefetch";
Expand Down Expand Up @@ -101,8 +101,9 @@ public void FetchStepCleansUpBadPrefetchPack()
this.TempPackRoot.ShouldBeADirectory(this.fileSystem).WithNoItems();
}

// WindowsOnly because the test depends on Windows-specific file sharing behavior
[TestCase, Order(4)]
[Category(Categories.NonNTFS.TestNeedsToLockFile)]
[Category(Categories.WindowsOnly)]
public void FetchStepFailsWhenItCannotRemoveABadPrefetchPack()
{
this.Enlistment.Unregister();
Expand All @@ -119,10 +120,11 @@ public void FetchStepFailsWhenItCannotRemoveABadPrefetchPack()
// Open a handle to the bad pack that will prevent fetch-commits-and-trees from being able to delete it
using (FileStream stream = new FileStream(badPackPath, FileMode.Open, FileAccess.Read, FileShare.None))
{
string output = this.Enlistment.RunVerb("fetch", failOnError: false);
output.ShouldContain($"Unable to delete {badPackPath}");
this.Enlistment.RunVerb("fetch", failOnError: false);
}

badPackPath.ShouldBeAFile(this.fileSystem).WithContents(badContents);

// After handle is closed fetching commits and trees should succeed
this.Enlistment.RunVerb("fetch");

Expand Down

0 comments on commit 00f8ea1

Please sign in to comment.