Skip to content

Commit

Permalink
fix test manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
ryfu-msft committed Nov 13, 2023
1 parent 97dba49 commit 01ccda4
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/ExecutionContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ namespace AppInstaller::CLI::Execution
{
if (Settings::ExperimentalFeature::IsEnabled(ExperimentalFeature::Feature::Resume))
{
if (m_checkpointManager && (!IsTerminated() || GetTerminationHR() != APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_TO_INSTALL))
if (m_checkpointManager && (!IsTerminated() || GetTerminationHR() != APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_FOR_INSTALL))
{
m_checkpointManager->CleanUpDatabase();
}
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Workflows/DependenciesFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ namespace AppInstaller::CLI::Workflow
context.Reporter.Error() << Resource::String::RebootRequiredToEnableWindowsFeatureOverrideRequired << std::endl;
context.SetFlags(Execution::ContextFlag::RegisterResume);
context.SetFlags(Execution::ContextFlag::RebootRequired);
AICLI_TERMINATE_CONTEXT(APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_TO_INSTALL);
AICLI_TERMINATE_CONTEXT(APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_FOR_INSTALL);
}
}
else
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/Workflows/InstallFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ namespace AppInstaller::CLI::Workflow
case ExpectedReturnCodeEnum::RebootRequiredToFinish:
return ExpectedReturnCode(returnCode, APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_TO_FINISH, Resource::String::InstallFlowReturnCodeRebootRequiredToFinish);
case ExpectedReturnCodeEnum::RebootRequiredForInstall:
return ExpectedReturnCode(returnCode, APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_TO_INSTALL, Resource::String::InstallFlowReturnCodeRebootRequiredForInstall);
return ExpectedReturnCode(returnCode, APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_FOR_INSTALL, Resource::String::InstallFlowReturnCodeRebootRequiredForInstall);
case ExpectedReturnCodeEnum::RebootInitiated:
return ExpectedReturnCode(returnCode, APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_INITIATED, Resource::String::InstallFlowReturnCodeRebootInitiated);
case ExpectedReturnCodeEnum::CancelledByUser:
Expand Down Expand Up @@ -484,7 +484,7 @@ namespace AppInstaller::CLI::Workflow
context.Reporter.Warn() << returnCode.Message << std::endl;
terminationHR = S_OK;
break;
case APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_TO_INSTALL:
case APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_FOR_INSTALL:
// REBOOT_REQUIRED_TO_INSTALL is treated as an error since installation has not yet completed.
context.SetFlags(ContextFlag::RebootRequired);
// TODO: Add separate workflow to handle restart registration for resume.
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLIE2ETests/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public class ErrorCode
public const int ERROR_INSTALL_NO_NETWORK = unchecked((int)0x8A150107);
public const int ERROR_INSTALL_CONTACT_SUPPORT = unchecked((int)0x8A150108);
public const int ERROR_INSTALL_REBOOT_REQUIRED_TO_FINISH = unchecked((int)0x8A150109);
public const int ERROR_INSTALL_REBOOT_REQUIRED_TO_INSTALL = unchecked((int)0x8A15010A);
public const int ERROR_INSTALL_REBOOT_REQUIRED_FOR_INSTALL = unchecked((int)0x8A15010A);
public const int ERROR_INSTALL_REBOOT_INITIATED = unchecked((int)0x8A15010B);
public const int ERROR_INSTALL_CANCELLED_BY_USER = unchecked((int)0x8A15010C);
public const int ERROR_INSTALL_ALREADY_INSTALLED = unchecked((int)0x8A15010D);
Expand Down
9 changes: 5 additions & 4 deletions src/AppInstallerCLIE2ETests/ResumeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void InstallRequiresRebootToFinish()
var checkpointsDir = TestCommon.GetCheckpointsDirectory();
int initialCheckpointsCount = Directory.Exists(checkpointsDir) ? Directory.GetDirectories(checkpointsDir).Length : 0;

var result = TestCommon.RunAICLICommand("install", $"AppInstallerTest.RebootRequired --custom '/ExitCode 9'");
var result = TestCommon.RunAICLICommand("install", $"--id AppInstallerTest.RebootRequired --custom '/ExitCode 9'");
Assert.AreNotEqual(Constants.ErrorCode.ERROR_INSTALL_REBOOT_REQUIRED_TO_FINISH, result.ExitCode);
Assert.True(result.StdOut.Contains("Restart your PC to finish installation."));

Expand All @@ -89,14 +89,15 @@ public void InstallRequiresRebootToFinish()
/// <summary>
/// Test install a package that returns REBOOT_REQUIRED_TO_INSTALL and verify that resume command can be called successfully.
/// </summary>
[Test]
public void InstallRequiresRebootToInstall()
{
var checkpointsDir = TestCommon.GetCheckpointsDirectory();

int initialCheckpointsCount = Directory.Exists(checkpointsDir) ? Directory.GetDirectories(checkpointsDir).Length : 0;

var result = TestCommon.RunAICLICommand("install", $"AppInstallerTest.RebootRequired --custom '/ExitCode 10'");
Assert.AreNotEqual(Constants.ErrorCode.ERROR_INSTALL_REBOOT_REQUIRED_TO_INSTALL, result.ExitCode);
var result = TestCommon.RunAICLICommand("install", $"--id AppInstallerTest.RebootRequired --custom '/ExitCode 10'");
Assert.AreNotEqual(Constants.ErrorCode.ERROR_INSTALL_REBOOT_REQUIRED_FOR_INSTALL, result.ExitCode);
Assert.True(result.StdOut.Contains("Installation failed. Restart your PC then try again."));

int actualCheckpointsCount = Directory.GetDirectories(checkpointsDir).Length;
Expand All @@ -110,7 +111,7 @@ public void InstallRequiresRebootToInstall()

// Resume output should be the same as the install result.
var resumeResult = TestCommon.RunAICLICommand("resume", $"-g {checkpoint.Name}");
Assert.AreNotEqual(Constants.ErrorCode.ERROR_INSTALL_REBOOT_REQUIRED_TO_INSTALL, resumeResult.ExitCode);
Assert.AreNotEqual(Constants.ErrorCode.ERROR_INSTALL_REBOOT_REQUIRED_FOR_INSTALL, resumeResult.ExitCode);
Assert.True(resumeResult.StdOut.Contains("Installation failed. Restart your PC then try again."));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Installers:
ReturnResponse: rebootRequiredToFinish
ReturnResponseUrl: https://DefaultReturnResponseUrl.com
- InstallerReturnCode: 10
ReturnResponse: rebootRequiredToInstall
ReturnResponse: rebootRequiredForInstall
ReturnResponseUrl: https://DefaultReturnResponseUrl.com
ManifestType: singleton
ManifestVersion: 1.4.0
ManifestVersion: 1.6.0
4 changes: 2 additions & 2 deletions src/AppInstallerCLITests/ResumeFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ TEST_CASE("ResumeFlow_WindowsFeature_RebootFailures", "[Resume][windowsFeature]"
install.Execute(context);
INFO(installOutput.str());

REQUIRE(context.GetTerminationHR() == APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_TO_INSTALL);
REQUIRE(context.GetTerminationHR() == APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_FOR_INSTALL);
REQUIRE(installOutput.str().find(Resource::LocString(Resource::String::FailedToRegisterReboot).get()) != std::string::npos);
}
SECTION("Initiate reboot fails")
Expand All @@ -243,7 +243,7 @@ TEST_CASE("ResumeFlow_WindowsFeature_RebootFailures", "[Resume][windowsFeature]"
install.Execute(context);
INFO(installOutput.str());

REQUIRE(context.GetTerminationHR() == APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_TO_INSTALL);
REQUIRE(context.GetTerminationHR() == APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_FOR_INSTALL);
REQUIRE(installOutput.str().find(Resource::LocString(Resource::String::FailedToInitiateReboot).get()) != std::string::npos);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLITests/WindowsFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ TEST_CASE("InstallFlow_RebootRequired", "[windowsFeature]")
install.Execute(context);
INFO(installOutput.str());

REQUIRE(context.GetTerminationHR() == APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_TO_INSTALL);
REQUIRE(context.GetTerminationHR() == APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_FOR_INSTALL);
REQUIRE(!std::filesystem::exists(installResultPath.GetPath()));
REQUIRE(installOutput.str().find(Resource::LocString(Resource::String::RebootRequiredToEnableWindowsFeatureOverrideRequired).get()) != std::string::npos);
}
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerSharedLib/Errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ namespace AppInstaller
WINGET_HRESULT_INFO(APPINSTALLER_CLI_ERROR_INSTALL_NO_NETWORK, "This application requires internet connectivity. Connect to a network then try again."),
WINGET_HRESULT_INFO(APPINSTALLER_CLI_ERROR_INSTALL_CONTACT_SUPPORT, "This application encountered an error during installation. Contact support."),
WINGET_HRESULT_INFO(APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_TO_FINISH, "Restart your PC to finish installation."),
WINGET_HRESULT_INFO(APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_TO_INSTALL, "Installation failed. Restart your PC then try again."),
WINGET_HRESULT_INFO(APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_FOR_INSTALL, "Installation failed. Restart your PC then try again."),
WINGET_HRESULT_INFO(APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_INITIATED, "Your PC will restart to finish installation."),
WINGET_HRESULT_INFO(APPINSTALLER_CLI_ERROR_INSTALL_CANCELLED_BY_USER, "You cancelled the installation."),
WINGET_HRESULT_INFO(APPINSTALLER_CLI_ERROR_INSTALL_ALREADY_INSTALLED, "Another version of this application is already installed."),
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerSharedLib/Public/AppInstallerErrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
#define APPINSTALLER_CLI_ERROR_INSTALL_NO_NETWORK ((HRESULT)0x8A150107)
#define APPINSTALLER_CLI_ERROR_INSTALL_CONTACT_SUPPORT ((HRESULT)0x8A150108)
#define APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_TO_FINISH ((HRESULT)0x8A150109)
#define APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_TO_INSTALL ((HRESULT)0x8A15010A)
#define APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_REQUIRED_FOR_INSTALL ((HRESULT)0x8A15010A)
#define APPINSTALLER_CLI_ERROR_INSTALL_REBOOT_INITIATED ((HRESULT)0x8A15010B)
#define APPINSTALLER_CLI_ERROR_INSTALL_CANCELLED_BY_USER ((HRESULT)0x8A15010C)
#define APPINSTALLER_CLI_ERROR_INSTALL_ALREADY_INSTALLED ((HRESULT)0x8A15010D)
Expand Down

0 comments on commit 01ccda4

Please sign in to comment.