Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions doc/ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## New in v1.29
## New in v1.30

Nothing yet.

## Bug Fixes

* None yet
* Updated NUnit to v4
20 changes: 10 additions & 10 deletions src/AppInstallerCLIE2ETests/AppShutdownTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// -----------------------------------------------------------------------------
ο»Ώ// -----------------------------------------------------------------------------
// <copyright file="AppShutdownTests.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
// </copyright>
Expand Down Expand Up @@ -98,7 +98,7 @@ public void RegisterApplicationTest()

// The ctrl-c command terminates the batch file before the exit code file gets created.
// Look for the output.
Assert.True(testCmdTask.Result.StdOut.Contains("Succeeded waiting for app shutdown event"));
Assert.That(testCmdTask.Result.StdOut.Contains("Succeeded waiting for app shutdown event"), Is.True);
}

/// <summary>
Expand All @@ -111,13 +111,13 @@ public void CanUnloadNowTest()

var lines = result.StdOut.Split('\n', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);

Assert.AreEqual(5, lines.Length);
Assert.True(lines[0].Contains("Internal objects:"));
Assert.False(lines[0].Contains("Internal objects: 0"));
Assert.True(lines[1].Contains("External objects: 0"));
Assert.True(lines[2].Contains("DllCanUnloadNow"));
Assert.True(lines[3].Contains("Internal objects: 0"));
Assert.True(lines[4].Contains("External objects: 0"));
Assert.That(lines.Length, Is.EqualTo(5));
Assert.That(lines[0].Contains("Internal objects:"), Is.True);
Assert.That(lines[0].Contains("Internal objects: 0"), Is.False);
Assert.That(lines[1].Contains("External objects: 0"), Is.True);
Assert.That(lines[2].Contains("DllCanUnloadNow"), Is.True);
Assert.That(lines[3].Contains("Internal objects: 0"), Is.True);
Assert.That(lines[4].Contains("External objects: 0"), Is.True);
}

/// <summary>
Expand All @@ -127,7 +127,7 @@ public void CanUnloadNowTest()
public void TermSignalHandler()
{
var result = TestCommon.RunAICLICommand("test", "term-signal-handler --verbose");
Assert.True(result.StdOut.Contains("Got a window handle"));
Assert.That(result.StdOut.Contains("Got a window handle"), Is.True);
}
}
}
132 changes: 66 additions & 66 deletions src/AppInstallerCLIE2ETests/ConfigureCommand.cs

Large diffs are not rendered by default.

146 changes: 73 additions & 73 deletions src/AppInstallerCLIE2ETests/ConfigureExportCommand.cs

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions src/AppInstallerCLIE2ETests/ConfigureListCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// -----------------------------------------------------------------------------
ο»Ώ// -----------------------------------------------------------------------------
// <copyright file="ConfigureListCommand.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
// </copyright>
Expand Down Expand Up @@ -34,11 +34,11 @@ public void OneTimeTeardown()
public void ListAllConfigurations()
{
var result = TestCommon.RunAICLICommand(ConfigureWithAgreementsAndVerbose, TestCommon.GetTestDataFile("Configuration\\Configure_TestRepo.yml"));
Assert.AreEqual(0, result.ExitCode);
Assert.That(result.ExitCode, Is.EqualTo(0));

result = TestCommon.RunAICLICommand("configure list", "--verbose");
Assert.AreEqual(0, result.ExitCode);
Assert.True(result.StdOut.Contains(ConfigureTestRepoFile));
Assert.That(result.ExitCode, Is.EqualTo(0));
Assert.That(result.StdOut.Contains(ConfigureTestRepoFile), Is.True);
}

/// <summary>
Expand All @@ -48,13 +48,13 @@ public void ListAllConfigurations()
public void ListSpecificConfiguration()
{
var result = TestCommon.RunAICLICommand(ConfigureWithAgreementsAndVerbose, TestCommon.GetTestDataFile("Configuration\\Configure_TestRepo.yml"));
Assert.AreEqual(0, result.ExitCode);
Assert.That(result.ExitCode, Is.EqualTo(0));

string guid = TestCommon.GetConfigurationInstanceIdentifierFor(ConfigureTestRepoFile);
result = TestCommon.RunAICLICommand("configure list", $"-h {guid}");
Assert.AreEqual(0, result.ExitCode);
Assert.True(result.StdOut.Contains(guid));
Assert.True(result.StdOut.Contains(ConfigureTestRepoFile));
Assert.That(result.ExitCode, Is.EqualTo(0));
Assert.That(result.StdOut.Contains(guid), Is.True);
Assert.That(result.StdOut.Contains(ConfigureTestRepoFile), Is.True);
}

/// <summary>
Expand All @@ -64,15 +64,15 @@ public void ListSpecificConfiguration()
public void RemoveConfiguration()
{
var result = TestCommon.RunAICLICommand(ConfigureWithAgreementsAndVerbose, TestCommon.GetTestDataFile("Configuration\\Configure_TestRepo.yml"));
Assert.AreEqual(0, result.ExitCode);
Assert.That(result.ExitCode, Is.EqualTo(0));

string guid = TestCommon.GetConfigurationInstanceIdentifierFor(ConfigureTestRepoFile);
result = TestCommon.RunAICLICommand("configure list", $"-h {guid} --remove");
Assert.AreEqual(0, result.ExitCode);
Assert.That(result.ExitCode, Is.EqualTo(0));

result = TestCommon.RunAICLICommand("configure list", "--verbose");
Assert.AreEqual(0, result.ExitCode);
Assert.False(result.StdOut.Contains(guid));
Assert.That(result.ExitCode, Is.EqualTo(0));
Assert.That(result.StdOut.Contains(guid), Is.False);
}

/// <summary>
Expand All @@ -82,15 +82,15 @@ public void RemoveConfiguration()
public void OutputConfiguration()
{
var result = TestCommon.RunAICLICommand(ConfigureWithAgreementsAndVerbose, TestCommon.GetTestDataFile("Configuration\\Configure_TestRepo.yml"));
Assert.AreEqual(0, result.ExitCode);
Assert.That(result.ExitCode, Is.EqualTo(0));

string guid = TestCommon.GetConfigurationInstanceIdentifierFor(ConfigureTestRepoFile);
string tempFile = TestCommon.GetRandomTestFile(".yml");
result = TestCommon.RunAICLICommand("configure list", $"-h {guid} --output {tempFile}");
Assert.AreEqual(0, result.ExitCode);
Assert.That(result.ExitCode, Is.EqualTo(0));

result = TestCommon.RunAICLICommand("configure validate", $"--verbose {tempFile}");
Assert.AreEqual(Constants.ErrorCode.S_FALSE, result.ExitCode);
Assert.That(result.ExitCode, Is.EqualTo(Constants.ErrorCode.S_FALSE));
}

private void DeleteTxtFiles()
Expand Down
18 changes: 8 additions & 10 deletions src/AppInstallerCLIE2ETests/ConfigureProcessorPathCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// -----------------------------------------------------------------------------
ο»Ώ// -----------------------------------------------------------------------------
// <copyright file="ConfigureProcessorPathCommand.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
// </copyright>
Expand Down Expand Up @@ -74,12 +74,12 @@ public void ProcessorPath_AuditOutput_ShowsPathAndHash()

// Audit header must appear regardless of whether the configure succeeds or fails,
// because audit output happens during factory setup before DSC is invoked.
Assert.True(result.StdOut.Contains("Custom processor path:"), $"Expected audit header in output. StdOut: {result.StdOut}");
Assert.True(result.StdOut.Contains($" Path: {processorPath}"), $"Expected path in audit output. StdOut: {result.StdOut}");
Assert.True(result.StdOut.Contains(" Hash: "), $"Expected hash in audit output. StdOut: {result.StdOut}");
Assert.That(result.StdOut.Contains("Custom processor path:"), Is.True, $"Expected audit header in output. StdOut: {result.StdOut}");
Assert.That(result.StdOut.Contains($" Path: {processorPath}"), Is.True, $"Expected path in audit output. StdOut: {result.StdOut}");
Assert.That(result.StdOut.Contains(" Hash: "), Is.True, $"Expected hash in audit output. StdOut: {result.StdOut}");

// dsc.exe is an app execution alias; the alias marker must be present.
Assert.True(result.StdOut.Contains("Type: App execution alias"), $"Expected app execution alias marker. StdOut: {result.StdOut}");
Assert.That(result.StdOut.Contains("Type: App execution alias"), Is.True, $"Expected app execution alias marker. StdOut: {result.StdOut}");
}

/// <summary>
Expand All @@ -102,7 +102,7 @@ public void ProcessorPath_AuditOutput_HashIsValidSHA256()
Command,
$"--accept-configuration-agreements --processor-path \"{processorPath}\" \"{configFile}\" --no-progress");

Assert.True(result.StdOut.Contains(" Hash: "), $"Expected hash in audit output. StdOut: {result.StdOut}");
Assert.That(result.StdOut.Contains(" Hash: "), Is.True, $"Expected hash in audit output. StdOut: {result.StdOut}");

// Extract the hash value from " Hash: <value>"
int hashLabelIndex = result.StdOut.IndexOf(" Hash: ");
Expand All @@ -114,10 +114,8 @@ public void ProcessorPath_AuditOutput_HashIsValidSHA256()
? result.StdOut.Substring(hashStart, hashEnd - hashStart).Trim()
: result.StdOut.Substring(hashStart).Trim();

Assert.AreEqual(64, hashValue.Length, $"Expected 64-character SHA256 hash, got: '{hashValue}'");
Assert.True(
Regex.IsMatch(hashValue, "^[0-9a-f]{64}$"),
$"Expected lowercase hex hash, got: '{hashValue}'");
Assert.That(hashValue.Length, Is.EqualTo(64), $"Expected 64-character SHA256 hash, got: '{hashValue}'");
Assert.That(Regex.IsMatch(hashValue, "^[0-9a-f]{64}$"), Is.True, $"Expected lowercase hex hash, got: '{hashValue}'");
}

/// <summary>
Expand Down
58 changes: 29 additions & 29 deletions src/AppInstallerCLIE2ETests/ConfigureShowCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// -----------------------------------------------------------------------------
ο»Ώ// -----------------------------------------------------------------------------
// <copyright file="ConfigureShowCommand.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. Licensed under the MIT License.
// </copyright>
Expand Down Expand Up @@ -45,8 +45,8 @@ public void ShowDetailsFromGallery()
TestCommon.EnsureModuleState(Constants.GalleryTestModuleName, present: false);

var result = TestCommon.RunAICLICommand("configure show", $"{TestCommon.GetTestDataFile("Configuration\\PSGallery_NoModule_NoSettings.yml")} --verbose", timeOut: 120000);
Assert.AreEqual(0, result.ExitCode);
Assert.True(result.StdOut.Contains(Constants.PSGalleryName));
Assert.That(result.ExitCode, Is.EqualTo(0));
Assert.That(result.StdOut, Does.Contain(Constants.PSGalleryName));
}

/// <summary>
Expand All @@ -58,8 +58,8 @@ public void ShowDetailsFromTestRepo()
TestCommon.EnsureModuleState(Constants.SimpleTestModuleName, present: false);

var result = TestCommon.RunAICLICommand("configure show", $"{TestCommon.GetTestDataFile("Configuration\\ShowDetails_TestRepo.yml")} --verbose");
Assert.AreEqual(0, result.ExitCode);
Assert.True(result.StdOut.Contains(Constants.TestRepoName));
Assert.That(result.ExitCode, Is.EqualTo(0));
Assert.That(result.StdOut, Does.Contain(Constants.TestRepoName));
}

/// <summary>
Expand All @@ -81,8 +81,8 @@ public void ShowDetailsFromLocal(TestCommon.TestModuleLocation location)
}

var result = TestCommon.RunAICLICommand("configure show", args);
Assert.AreEqual(0, result.ExitCode);
Assert.True(result.StdOut.Contains(Constants.LocalModuleDescriptor));
Assert.That(result.ExitCode, Is.EqualTo(0));
Assert.That(result.StdOut, Does.Contain(Constants.LocalModuleDescriptor));
}

/// <summary>
Expand All @@ -94,8 +94,8 @@ public void ShowDetails_Schema0_3_Succeeds()
TestCommon.EnsureModuleState(Constants.SimpleTestModuleName, present: false);

var result = TestCommon.RunAICLICommand("configure show", $"{TestCommon.GetTestDataFile("Configuration\\ShowDetails_TestRepo_0_3.yml")} --verbose");
Assert.AreEqual(0, result.ExitCode);
Assert.True(result.StdOut.Contains(Constants.TestRepoName));
Assert.That(result.ExitCode, Is.EqualTo(0));
Assert.That(result.StdOut, Does.Contain(Constants.TestRepoName));
}

/// <summary>
Expand All @@ -105,8 +105,8 @@ public void ShowDetails_Schema0_3_Succeeds()
public void ShowDetails_Schema0_3_Parameters()
{
var result = TestCommon.RunAICLICommand("configure show", TestCommon.GetTestDataFile("Configuration\\WithParameters_0_3.yml"));
Assert.AreEqual(0, result.ExitCode);
Assert.True(result.StdOut.Contains("Failed to get detailed information about the configuration."));
Assert.That(result.ExitCode, Is.EqualTo(0));
Assert.That(result.StdOut, Does.Contain("Failed to get detailed information about the configuration."));
}

/// <summary>
Expand All @@ -116,8 +116,8 @@ public void ShowDetails_Schema0_3_Parameters()
public void ShowDetailsFromHttpsConfigurationFile()
{
var result = TestCommon.RunAICLICommand("configure show", $"{Constants.TestSourceUrl}/TestData/Configuration/ShowDetails_TestRepo.yml --verbose");
Assert.AreEqual(0, result.ExitCode);
Assert.True(result.StdOut.Contains(Constants.TestRepoName));
Assert.That(result.ExitCode, Is.EqualTo(0));
Assert.That(result.StdOut, Does.Contain(Constants.TestRepoName));
}

/// <summary>
Expand All @@ -127,10 +127,10 @@ public void ShowDetailsFromHttpsConfigurationFile()
public void ShowTruncatedDetailsAndFileContent()
{
var result = TestCommon.RunAICLICommand("configure show", $"{TestCommon.GetTestDataFile("Configuration\\LargeContentStrings.yml")} --verbose");
Assert.AreEqual(0, result.ExitCode);
Assert.True(result.StdOut.Contains("<this value has been truncated; inspect the file contents for the complete text>"));
Assert.True(result.StdOut.Contains("Some of the data present in the configuration file was truncated for this output; inspect the file contents for the complete content."));
Assert.False(result.StdOut.Contains("Line5"));
Assert.That(result.ExitCode, Is.EqualTo(0));
Assert.That(result.StdOut.Contains("<this value has been truncated; inspect the file contents for the complete text>"), Is.True);
Assert.That(result.StdOut.Contains("Some of the data present in the configuration file was truncated for this output; inspect the file contents for the complete content."), Is.True);
Assert.That(result.StdOut.Contains("Line5"), Is.False);
}

/// <summary>
Expand All @@ -140,11 +140,11 @@ public void ShowTruncatedDetailsAndFileContent()
public void ShowFromHistory()
{
var result = TestCommon.RunAICLICommand("configure --accept-configuration-agreements --verbose", TestCommon.GetTestDataFile("Configuration\\Configure_TestRepo.yml"));
Assert.AreEqual(0, result.ExitCode);
Assert.That(result.ExitCode, Is.EqualTo(0));

string guid = TestCommon.GetConfigurationInstanceIdentifierFor("Configure_TestRepo.yml");
result = TestCommon.RunAICLICommand("configure show", $"-h {guid}");
Assert.AreEqual(0, result.ExitCode);
Assert.That(result.ExitCode, Is.EqualTo(0));
}

/// <summary>
Expand All @@ -154,7 +154,7 @@ public void ShowFromHistory()
public void ShowWithBadProcessorIdentifier()
{
var result = TestCommon.RunAICLICommand("configure show", $"{TestCommon.GetTestDataFile("Configuration\\Unknown_Processor.yml")} --verbose");
Assert.AreEqual(Constants.ErrorCode.CONFIG_ERROR_INVALID_FIELD_VALUE, result.ExitCode);
Assert.That(result.ExitCode, Is.EqualTo(Constants.ErrorCode.CONFIG_ERROR_INVALID_FIELD_VALUE));
}

/// <summary>
Expand All @@ -164,7 +164,7 @@ public void ShowWithBadProcessorIdentifier()
public void ShowDetails_DSCv3()
{
var result = TestCommon.RunAICLICommand("configure show", $"{TestCommon.GetTestDataFile("Configuration\\ShowDetails_DSCv3.yml")} --verbose");
Assert.AreEqual(0, result.ExitCode);
Assert.That(result.ExitCode, Is.EqualTo(0));

var outputLines = result.StdOut.Split('\n');
int startLine = -1;
Expand All @@ -176,11 +176,11 @@ public void ShowDetails_DSCv3()
}
}

Assert.AreNotEqual(-1, startLine);
Assert.LessOrEqual(3, outputLines.Length - startLine);
Assert.That(startLine, Is.Not.EqualTo(-1));
Assert.That(outputLines.Length - startLine, Is.GreaterThanOrEqualTo(3));

// outputLines[1] should contain the discovered resource string if working properly.
Assert.AreEqual("Description 1.", outputLines[startLine + 2].Trim());
Assert.That(outputLines[startLine + 2].Trim(), Is.EqualTo("Description 1."));
}

/// <summary>
Expand All @@ -190,11 +190,11 @@ public void ShowDetails_DSCv3()
public void ShowFromHistory_DSCv3()
{
var result = TestCommon.RunAICLICommand("configure --accept-configuration-agreements --verbose", TestCommon.GetTestDataFile("Configuration\\ShowDetails_DSCv3.yml"));
Assert.AreEqual(0, result.ExitCode);
Assert.That(result.ExitCode, Is.EqualTo(0));

string guid = TestCommon.GetConfigurationInstanceIdentifierFor("ShowDetails_DSCv3.yml");
result = TestCommon.RunAICLICommand("configure show", $"-h {guid} --");
Assert.AreEqual(0, result.ExitCode);
Assert.That(result.ExitCode, Is.EqualTo(0));

var outputLines = result.StdOut.Split('\n');
int startLine = -1;
Expand All @@ -206,11 +206,11 @@ public void ShowFromHistory_DSCv3()
}
}

Assert.AreNotEqual(-1, startLine);
Assert.LessOrEqual(3, outputLines.Length - startLine);
Assert.That(startLine, Is.Not.EqualTo(-1));
Assert.That(outputLines.Length - startLine, Is.GreaterThanOrEqualTo(3));

// outputLines[1] should contain the discovered resource string if working properly.
Assert.AreEqual("Description 1.", outputLines[startLine + 2].Trim());
Assert.That(outputLines[startLine + 2].Trim(), Is.EqualTo("Description 1."));
}

private void DeleteResourceArtifacts()
Expand Down
Loading
Loading