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

Run functional tests against Scalar-in-C #505

Merged
merged 24 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
981eb2b
RunVerbTests: adapt to new prefetch ref location
derrickstolee May 21, 2021
3e5bd26
Adjust for FSMonitor v2
dscho Jun 7, 2021
22ff683
Update Git to v2.32.0
derrickstolee May 19, 2021
85f7c31
Remove some references to 'watchman'
derrickstolee Jun 7, 2021
a5cecef
Update Git to v2.32.0.vfs.0.0
derrickstolee Jun 7, 2021
55f40d2
FunctionalTests: always test on PATH
derrickstolee Apr 23, 2021
a10d61f
ci: stop modifying PATH
derrickstolee Apr 23, 2021
3c4b36b
Drop unused service test infrastructure
derrickstolee Apr 30, 2021
2b3c02f
FunctionalTests: remove unnecessary tests
derrickstolee May 13, 2021
b4caf6b
FunctionalTests: delete PackfileMaintenanceStepTests
derrickstolee May 13, 2021
d12e6b2
FunctionalTests: drop RepoRegistryTests
derrickstolee May 13, 2021
9dca0a9
FunctionalTests: drop CommitGraphStepTests
derrickstolee May 13, 2021
0896d5d
FunctionalTests: drop RunVerbTests
derrickstolee May 13, 2021
6e0ae93
FunctionalTests: drop ScalarVerbTests
derrickstolee May 13, 2021
ed26abe
DiagnoseTests: allow Scalar to report paths with forward slashes
dscho May 12, 2021
57950e9
RepoRegistryTests: work around forward slash vs backslash issue
dscho May 18, 2021
f2c2fce
SharedCacheTests: be more resilient to whitespace
derrickstolee May 13, 2021
94fabb0
CloneTests: use error code 128
derrickstolee May 13, 2021
f2e3248
CloneTests: relax error message check
derrickstolee May 13, 2021
da845bf
Get rid of `--internal_use_only`
dscho May 5, 2021
06e8e87
ci: skip endpoint requiring authentication
dscho May 12, 2021
2db12ba
ci: install Scalar as a component
derrickstolee Jun 7, 2021
149731a
ci: drop experimental from the build matrix
derrickstolee Jun 10, 2021
53b2bf1
Update Git to include Scalar-in-C
dscho Jun 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [ main, releases/* ]

env:
SCALAR_TEST_SKIP_VSTS_INFO: true

jobs:
validate_scalar:
name: "CI"
Expand All @@ -15,7 +18,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, windows-2019, macos-10.15]
features: [false, experimental]
features: [ignored]

env:
BUILD_FRAGMENT: bin/Release/netcoreapp3.1
Expand Down Expand Up @@ -94,7 +97,7 @@ jobs:
Remove-Item 'C:\Program Files\Git' -Recurse -Force
Write-Host 'Installing GitForWindows ...'
$files = Get-ChildItem . -Recurse -File -Include 'Git-*.vfs.*.exe'
& $files[0].Fullname /DIR="C:\Program Files\Git" /NOICONS /COMPONENTS="ext,ext\shellhere,ext\guihere,assoc,assoc_sh" /GROUP="Git" /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /ALLOWDOWNGRADE=1 /LOG=install.log
& $files[0].Fullname /DIR="C:\Program Files\Git" /NOICONS /COMPONENTS="ext,ext\shellhere,ext\guihere,assoc,assoc_sh,scalar" /GROUP="Git" /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /ALLOWDOWNGRADE=1 /LOG=install.log
Wait-Process $files[0].Basename
Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\GitForWindows'

Expand All @@ -114,8 +117,7 @@ jobs:
mkdir -p "$TRACE2_BASENAME/Perf"
git version --build-options
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 --full-suite

- id: trace2_zip_unix
if: runner.os != 'Windows' && ( success() || failure() ) && ( steps.functional_test.conclusion == 'success' || steps.functional_test.conclusion == 'failure' )
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
VFS for Git (which is less flexible). Only update that version if we rely upon a
new command-line interface in Git or if there is a truly broken interaction.
-->
<GitPackageVersion>2.20210505.2</GitPackageVersion>
<GitPackageVersion>2.20210610.2</GitPackageVersion>
<MinimumGitVersion>v2.25.0.vfs.1.1</MinimumGitVersion>

<WatchmanPackageUrl>https://github.com/facebook/watchman/releases/download/v2020.08.03.00/watchman-v2020.08.03.00-windows.zip</WatchmanPackageUrl>
Expand Down
2 changes: 0 additions & 2 deletions Scalar.Common/ScalarConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@ public static class InstalledGit

public static class VerbParameters
{
public const string InternalUseOnly = "internal_use_only";

public static class Maintenance
{
public const string AllTasksName = "all";
Expand Down
17 changes: 0 additions & 17 deletions Scalar.FunctionalTests/GlobalSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,6 @@ public void RunBeforeAnyTests()
[OneTimeTearDown]
public void RunAfterAllTests()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
string serviceLogFolder = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
"Scalar",
ScalarServiceProcess.TestServiceName,
"Logs");

Console.WriteLine("Scalar.Service logs at '{0}' attached below.\n\n", serviceLogFolder);
foreach (string filename in TestResultsHelper.GetAllFilesInDirectory(serviceLogFolder))
{
TestResultsHelper.OutputFileContents(filename);
}

ScalarServiceProcess.UninstallService();
}

PrintTestCaseStats.PrintRunTimeStats();
}
}
Expand Down
22 changes: 0 additions & 22 deletions Scalar.FunctionalTests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,6 @@ public static void Main(string[] args)
RunBeforeAnyTests();
Environment.ExitCode = runner.RunTests(includeCategories, excludeCategories);

try
{
// Shutdown the watchman server now that the tests are complete.
// Allows deleting the unwatched directories.
//
// Technically, we no longer try to start Watchman in the Functional Test Suite.
// However, on Linux (which doesn't currently support the Builtin FSMonitor), we
// allow the test startup to fallback and use Watchman (rather than failing the
// whole test). So for now, we keep this code to shutdown the server and ignore
// any errors.
//
ProcessHelper.Run("watchman", "shutdown-server");
}
catch (Exception)
{
// This is non-critical, and watchman may not be installed.
}

if (Debugger.IsAttached)
{
Console.WriteLine("Tests completed. Press Enter to exit.");
Expand All @@ -129,10 +111,6 @@ public static void Main(string[] args)

private static void RunBeforeAnyTests()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
ScalarServiceProcess.InstallService();
}
}
}
}
5 changes: 1 addition & 4 deletions Scalar.FunctionalTests/ScalarTestConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ public static string PathToScalar
{
get
{
return
TestScalarOnPath ?
Properties.Settings.Default.PathToScalar :
Path.Combine(Properties.Settings.Default.CurrentDirectory, Properties.Settings.Default.PathToScalar);
return Properties.Settings.Default.PathToScalar;
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions Scalar.FunctionalTests/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public static class Default
public static string ControlGitRepoRoot { get; set; }
public static string EnlistmentRoot { get; set; }
public static string PathToGitRoot { get; set; }
public static string PathToScalarService { get; set; }
public static string BinaryFileNameExtension { get; set; }

public static void Initialize()
Expand All @@ -50,7 +49,6 @@ public static void Initialize()
PathToBash = @"C:\Program Files\Git\bin\bash.exe";

ControlGitRepoRoot = @"C:\Repos\ScalarFunctionalTests\ControlRepo";
PathToScalarService = @"Scalar.Service.exe";
BinaryFileNameExtension = ".exe";
}
else
Expand Down

This file was deleted.

35 changes: 1 addition & 34 deletions Scalar.FunctionalTests/Tests/EnlistmentPerFixture/CloneTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,7 @@ namespace Scalar.FunctionalTests.Tests.EnlistmentPerFixture
[TestFixture]
public class CloneTests : TestsWithEnlistmentPerFixture
{
private const int ScalarGenericError = 3;

[TestCase]
public void CloneInsideExistingEnlistment()
{
ProcessResult result = this.RunCloneCommand(
this.Enlistment.EnlistmentRoot,
Path.Combine("src", "scalar", "test1"));
result.ExitCode.ShouldEqual(ScalarGenericError);
result.Output.ShouldContain("You can't clone inside an existing Scalar repo");
}

[TestCase]
public void CloneInNonEmptyDirectory()
{
string newEnlistmentRoot = ScalarFunctionalTestEnlistment.GetUniqueEnlistmentRoot();
string newEnlistmentFilePath = Path.Combine(newEnlistmentRoot, "test2");

FileSystemRunner fileSystem = FileSystemRunner.DefaultRunner;
fileSystem.CreateDirectory(newEnlistmentRoot);
newEnlistmentRoot.ShouldBeADirectory(fileSystem);
fileSystem.CreateEmptyFile(newEnlistmentFilePath);
newEnlistmentFilePath.ShouldBeAFile(fileSystem);

ProcessResult result = this.RunCloneCommand(
Path.GetDirectoryName(this.Enlistment.EnlistmentRoot),
newEnlistmentRoot);
result.ExitCode.ShouldEqual(ScalarGenericError);
result.Output.ShouldContain("exists and is not empty");

RepositoryHelpers.DeleteTestDirectory(newEnlistmentRoot);
}
private const int ScalarGenericError = 128;

[TestCase]
public void CloneWithLocalCachePathWithinSrc()
Expand All @@ -55,7 +24,6 @@ public void CloneWithLocalCachePathWithinSrc()
newEnlistmentRoot,
$"--local-cache-path {localCachePath}");
result.ExitCode.ShouldEqual(ScalarGenericError);
result.Output.ShouldContain("'--local-cache-path' cannot be inside the src folder");

localCachePath = Path.Combine(newEnlistmentRoot, "SRC", ".scalarCache");

Expand All @@ -70,7 +38,6 @@ public void CloneWithLocalCachePathWithinSrc()
else
{
result.ExitCode.ShouldEqual(ScalarGenericError);
result.Output.ShouldContain("'--local-cache-path' cannot be inside the src folder");
}

RepositoryHelpers.DeleteTestDirectory(newEnlistmentRoot);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;

namespace Scalar.FunctionalTests.Tests.EnlistmentPerFixture
{
Expand All @@ -22,6 +23,9 @@ public void DiagnoseProducesZipFile()
string zipFilePath = files.First();

zipFilePath.EndsWith(".zip").ShouldEqual(true);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
!output.Contains(zipFilePath))
zipFilePath = zipFilePath.Replace('\\', '/');
output.Contains(zipFilePath).ShouldEqual(true);
}
}
Expand Down
Loading