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

Use AppsAndFeaturesEntries DisplayVersion info for installed package version mapping #2213

Merged
merged 20 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from 19 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
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Workflows/UpdateFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace AppInstaller::CLI::Workflow
{
bool IsUpdateVersionApplicable(const Utility::Version& installedVersion, const Utility::Version& updateVersion)
{
return (installedVersion < updateVersion || updateVersion.IsLatest());
return installedVersion < updateVersion;
}

void AddToPackagesToInstallIfNotPresent(std::vector<std::unique_ptr<Execution::Context>>& packagesToInstall, std::unique_ptr<Execution::Context> packageContext)
Expand Down
11 changes: 0 additions & 11 deletions src/AppInstallerCLIE2ETests/AppInstallerCLIE2ETests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@
</Content>
</ItemGroup>

<ItemGroup>
<None Remove="TestData\ImportFiles\ImportFile-Bad-Invalid.json" />
<None Remove="TestData\ImportFiles\ImportFile-Bad-UnknownPackage.json" />
<None Remove="TestData\ImportFiles\ImportFile-Bad-UnknownPackageVersion.json" />
<None Remove="TestData\ImportFiles\ImportFile-Bad-UnknownSource.json" />
<None Remove="TestData\ImportFiles\ImportFile-Good.1.0.json" />
<None Remove="TestData\ImportFiles\ImportFile-Good.2.0.json" />
<None Remove="TestData\Manifests\TestPortableInstaller.2.0.0.0.yaml" />
<None Remove="TestData\Manifests\TestPortableInstaller.3.0.0.0_UninstallPrevious.yaml" />
</ItemGroup>

<ItemGroup>
<Content Include="..\..\doc\admx\DesktopAppInstaller.admx" Link="TestData\DesktopAppInstaller.admx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
9 changes: 9 additions & 0 deletions src/AppInstallerCLIE2ETests/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ public class ErrorCode
public const int ERROR_INVALID_TABLE_COLUMN = unchecked((int)0x8A15004E);
public const int ERROR_UPGRADE_VERSION_NOT_NEWER = unchecked((int)0x8A15004F);
public const int ERROR_UPGRADE_VERSION_UNKNOWN = unchecked((int)0x8A150050);
public const int ERROR_ICU_CONVERSION_ERROR = unchecked((int)0x8A150051);
public const int ERROR_PORTABLE_INSTALL_FAILED = unchecked((int)0x8A150052);
public const int ERROR_PORTABLE_REPARSE_POINT_NOT_SUPPORTED = unchecked((int)0x8A150053);
public const int ERROR_PORTABLE_PACKAGE_ALREADY_EXISTS = unchecked((int)0x8A150054);
public const int ERROR_PORTABLE_SYMLINK_PATH_IS_DIRECTORY = unchecked((int)0x8A150055);
public const int ERROR_INSTALLER_PROHIBITS_ELEVATION = unchecked((int)0x8A150056);
public const int ERROR_PORTABLE_UNINSTALL_FAILED = unchecked((int)0x8A150057);
public const int ERROR_ARP_VERSION_VALIDATION_FAILED = unchecked((int)0x8A150058);

public const int ERROR_INSTALL_PACKAGE_IN_USE = unchecked((int)0x8A150101);
public const int ERROR_INSTALL_INSTALL_IN_PROGRESS = unchecked((int)0x8A150102);
Expand All @@ -165,6 +173,7 @@ public class ErrorCode
public const int ERROR_INSTALL_ALREADY_INSTALLED = unchecked((int)0x8A15010D);
public const int ERROR_INSTALL_DOWNGRADE = unchecked((int)0x8A15010E);
public const int ERROR_INSTALL_BLOCKED_BY_POLICY = unchecked((int)0x8A15010F);
public const int ERROR_INSTALL_DEPENDENCIES = unchecked((int)0x8A150110);
}
}
}
41 changes: 41 additions & 0 deletions src/AppInstallerCLIE2ETests/ListCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,46 @@ public void ListAfterInstall()
Assert.True(result.StdOut.Contains("1.0.0.0"));
Assert.True(result.StdOut.Contains("2.0.0.0"));
}

[Test]
public void ListWithArpVersionMapping()
{
// No mapping performed
ArpVersionMappingTest("AppInstallerTest.TestArpVersionSameVersion", "TestArpVersionSameVersion", "0.5", "0.5", "< 1.0");

// Partial mapping performed(i.e. only if version falls within arp version range)
ArpVersionMappingTest("AppInstallerTest.TestArpVersionOppositeOrder", "TestArpVersionOppositeOrder", "10.1", "1.0", "10.1");
ArpVersionMappingTest("AppInstallerTest.TestArpVersionOppositeOrder", "TestArpVersionOppositeOrder", "9.9", "9.9", "> 2.0");

// Full mapping performed
ArpVersionMappingTest("AppInstallerTest.TestArpVersionSameOrder", "TestArpVersionSameOrder", "7.0", "< 1.0", "7.0");
ArpVersionMappingTest("AppInstallerTest.TestArpVersionSameOrder", "TestArpVersionSameOrder", "10.1", "1.0", "10.1");
ArpVersionMappingTest("AppInstallerTest.TestArpVersionSameOrder", "TestArpVersionSameOrder", "10.7", "< 2.0", "10.7");
ArpVersionMappingTest("AppInstallerTest.TestArpVersionSameOrder", "TestArpVersionSameOrder", "11.1", "2.0", "11.1");
ArpVersionMappingTest("AppInstallerTest.TestArpVersionSameOrder", "TestArpVersionSameOrder", "12.0", "> 2.0", "12.0");
}

private void ArpVersionMappingTest(string packageIdentifier, string displayNameOverride, string displayVersionOverride, string expectedListVersion, string notExpectedListVersion = "")
{
System.Guid guid = System.Guid.NewGuid();
string productCode = guid.ToString();
var installDir = TestCommon.GetRandomTestDir();

var result = TestCommon.RunAICLICommand("list", productCode);
Assert.AreEqual(Constants.ErrorCode.ERROR_NO_APPLICATIONS_FOUND, result.ExitCode);

result = TestCommon.RunAICLICommand("install", $"{packageIdentifier} --override \"/InstallDir {installDir} /ProductID {productCode} /DisplayName {displayNameOverride} /Version {displayVersionOverride}\"");
Assert.AreEqual(Constants.ErrorCode.S_OK, result.ExitCode);

result = TestCommon.RunAICLICommand("list", productCode);
Assert.AreEqual(Constants.ErrorCode.S_OK, result.ExitCode);

Assert.True(result.StdOut.Contains(packageIdentifier));
Assert.True(result.StdOut.Contains(expectedListVersion));
if (!string.IsNullOrEmpty(notExpectedListVersion))
{
Assert.False(result.StdOut.Contains(notExpectedListVersion));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
PackageIdentifier: AppInstallerTest.TestArpVersionOppositeOrder
PackageVersion: 1.0
PackageName: TestArpVersionOppositeOrder
PackageLocale: en-US
Publisher: Microsoft
License: Test
ShortDescription: E2E test for arp version test.
Installers:
- Architecture: x86
InstallerUrl: https://localhost:5001/TestKit/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe
InstallerType: exe
InstallerSha256: <EXEHASH>
AppsAndFeaturesEntries:
- DisplayVersion: "10.0"
- DisplayVersion: "10.5"
ManifestType: singleton
ManifestVersion: 1.2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
PackageIdentifier: AppInstallerTest.TestArpVersionOppositeOrder
PackageVersion: 2.0
PackageName: TestArpVersionOppositeOrder
PackageLocale: en-US
Publisher: Microsoft
License: Test
ShortDescription: E2E test for arp version test.
Installers:
- Architecture: x86
InstallerUrl: https://localhost:5001/TestKit/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe
InstallerType: exe
InstallerSha256: <EXEHASH>
AppsAndFeaturesEntries:
- DisplayVersion: "9.0"
- DisplayVersion: "9.5"
ManifestType: singleton
ManifestVersion: 1.2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PackageIdentifier: AppInstallerTest.TestArpVersionSameVersion
PackageVersion: 1.0
PackageName: TestArpVersionSameVersion
PackageLocale: en-US
Publisher: Microsoft
License: Test
ShortDescription: E2E test for arp version test.
Installers:
- Architecture: x86
InstallerUrl: https://localhost:5001/TestKit/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe
InstallerType: exe
InstallerSha256: <EXEHASH>
AppsAndFeaturesEntries:
- DisplayVersion: "1.0"
ManifestType: singleton
ManifestVersion: 1.2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
PackageIdentifier: AppInstallerTest.TestArpVersionSameOrder
PackageVersion: 1.0
PackageName: TestArpVersionSameOrder
PackageLocale: en-US
Publisher: Microsoft
License: Test
ShortDescription: E2E test for arp version test.
Installers:
- Architecture: x86
InstallerUrl: https://localhost:5001/TestKit/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe
InstallerType: exe
InstallerSha256: <EXEHASH>
AppsAndFeaturesEntries:
- DisplayVersion: "10.0"
- DisplayVersion: "10.5"
ManifestType: singleton
ManifestVersion: 1.2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
PackageIdentifier: AppInstallerTest.TestArpVersionSameOrder
PackageVersion: 2.0
PackageName: TestArpVersionSameOrder
PackageLocale: en-US
Publisher: Microsoft
License: Test
ShortDescription: E2E test for arp version test.
Installers:
- Architecture: x86
InstallerUrl: https://localhost:5001/TestKit/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe
InstallerType: exe
InstallerSha256: <EXEHASH>
AppsAndFeaturesEntries:
- DisplayVersion: "11.0"
- DisplayVersion: "11.5"
ManifestType: singleton
ManifestVersion: 1.2.0
15 changes: 15 additions & 0 deletions src/AppInstallerCLITests/AppInstallerCLITests.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,12 @@
<CopyFileToFolders Include="TestData\Manifest-Bad-VersionMissing.yaml">
<DeploymentContent>true</DeploymentContent>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\Manifest-Bad-ApproximateVersionInArpVersion.yaml">
<DeploymentContent>true</DeploymentContent>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\Manifest-Bad-ApproximateVersionInPackageVersion.yaml">
<DeploymentContent>true</DeploymentContent>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\Manifest-Good-InstallerTypeExe-Silent.yaml">
<DeploymentContent>true</DeploymentContent>
</CopyFileToFolders>
Expand Down Expand Up @@ -498,6 +504,15 @@
<CopyFileToFolders Include="TestData\Manifest-Good-PackageFamilyNameOnExe-Ver1_2.yaml">
<DeploymentContent>true</DeploymentContent>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\Manifest-Good-MultipleArpVersionDeclared.yaml">
<DeploymentContent>true</DeploymentContent>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\Manifest-Good-NoArpVersionDeclared.yaml">
<DeploymentContent>true</DeploymentContent>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\Manifest-Good-SingleArpVersionDeclared.yaml">
<DeploymentContent>true</DeploymentContent>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\Manifest-Encoding-ANSI.yaml">
<DeploymentContent>true</DeploymentContent>
</CopyFileToFolders>
Expand Down
15 changes: 15 additions & 0 deletions src/AppInstallerCLITests/AppInstallerCLITests.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@
<None Include="Run-TestsInPackage.ps1" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="TestData\Manifest-Bad-ApproximateVersionInArpVersion.yaml">
<Filter>TestData</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\Manifest-Bad-ApproximateVersionInPackageVersion.yaml">
<Filter>TestData</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\Manifest-Bad-AppsAndFeaturesEntriesOnMSIX.yaml">
<Filter>TestData</Filter>
</CopyFileToFolders>
Expand Down Expand Up @@ -393,9 +399,18 @@
<CopyFileToFolders Include="TestData\Manifest-Good-MultiLocale.yaml">
<Filter>TestData</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\Manifest-Good-MultipleArpVersionDeclared.yaml">
<Filter>TestData</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\Manifest-Good-NoArpVersionDeclared.yaml">
<Filter>TestData</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\Manifest-Good-PackageFamilyNameOnExe-Ver1_2.yaml">
<Filter>TestData</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\Manifest-Good-SingleArpVersionDeclared.yaml">
<Filter>TestData</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="TestData\Manifest-Good-Spaces.yaml">
<Filter>TestData</Filter>
</CopyFileToFolders>
Expand Down
Loading