Skip to content

Commit

Permalink
Make upgrade command correctly select latest applicable version (#796)
Browse files Browse the repository at this point in the history
  • Loading branch information
yao-msft authored Mar 15, 2021
1 parent c75c265 commit 30ac6b4
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/AppInstallerCLICore/Workflows/UpdateFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ namespace AppInstaller::CLI::Workflow
context.Add<Execution::Data::Installer>(std::move(installer));

updateFound = true;
break;
}
else
{
Expand Down
3 changes: 3 additions & 0 deletions src/AppInstallerCLITests/AppInstallerCLITests.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@
<CopyFileToFolders Include="TestData\UpdateFlowTest_Exe.yaml">
<DeploymentContent>true</DeploymentContent>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\UpdateFlowTest_Exe_2.yaml">
<DeploymentContent>true</DeploymentContent>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\UpdateFlowTest_Msix.yaml">
<DeploymentContent>true</DeploymentContent>
</CopyFileToFolders>
Expand Down
3 changes: 3 additions & 0 deletions src/AppInstallerCLITests/AppInstallerCLITests.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@
<CopyFileToFolders Include="TestData\UpdateFlowTest_Exe.yaml">
<Filter>TestData</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\UpdateFlowTest_Exe.yaml">
<Filter>TestData</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\UpdateFlowTest_Msix.yaml">
<Filter>TestData</Filter>
</CopyFileToFolders>
Expand Down
18 changes: 18 additions & 0 deletions src/AppInstallerCLITests/TestData/UpdateFlowTest_Exe_2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Same content with UpdateFlowTest_Exe.yaml but with higher version
Id: AppInstallerCliTest.TestExeInstaller
Version: 3.0.0.0
Name: AppInstaller Test Installer
Publisher: Microsoft Corporation
AppMoniker: AICLITestExe
License: Test
Switches:
Custom: /custom /ver3.0.0.0
SilentWithProgress: /silentwithprogress
Silent: /silence
Update: /update
Installers:
- Arch: x64
Url: https://ThisIsNotUsed
InstallerType: exe
Sha256: 65DB2F2AC2686C7F2FD69D4A4C6683B888DC55BFA20A0E32CA9F838B51689A3B
ManifestVersion: 0.1.0
4 changes: 3 additions & 1 deletion src/AppInstallerCLITests/WorkFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ namespace
{
auto manifest = YamlParser::CreateFromPath(TestDataFile("InstallFlowTest_Exe.yaml"));
auto manifest2 = YamlParser::CreateFromPath(TestDataFile("UpdateFlowTest_Exe.yaml"));
auto manifest3 = YamlParser::CreateFromPath(TestDataFile("UpdateFlowTest_Exe_2.yaml"));
result.Matches.emplace_back(
ResultMatch(
TestPackage::Make(
Expand All @@ -122,7 +123,7 @@ namespace
{ PackageVersionMetadata::StandardUninstallCommand, "C:\\uninstall.exe" },
{ PackageVersionMetadata::SilentUninstallCommand, "C:\\uninstall.exe /silence" },
},
std::vector<Manifest>{ manifest2, manifest },
std::vector<Manifest>{ manifest3, manifest2, manifest },
this->shared_from_this()
),
PackageMatchFilter(PackageMatchField::Id, MatchType::Exact, "AppInstallerCliTest.TestExeInstaller")));
Expand Down Expand Up @@ -877,6 +878,7 @@ TEST_CASE("UpdateFlow_UpdateExe", "[UpdateFlow][workflow]")
std::getline(updateResultFile, updateResultStr);
REQUIRE(updateResultStr.find("/update") != std::string::npos);
REQUIRE(updateResultStr.find("/silence") != std::string::npos);
REQUIRE(updateResultStr.find("/ver3.0.0.0") != std::string::npos);
}

TEST_CASE("UpdateFlow_UpdateMsix", "[UpdateFlow][workflow]")
Expand Down

0 comments on commit 30ac6b4

Please sign in to comment.