-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add E2E tests #85
Add E2E tests #85
Conversation
861ad23
to
017e08f
Compare
azure-pipelines.yml
Outdated
@@ -16,6 +16,7 @@ variables: | |||
buildPlatform: 'x86|x64|ARM' | |||
buildConfiguration: 'Release' | |||
appxPackageDir: '$(build.artifactStagingDirectory)\AppxPackages\\' | |||
appxVersion: '0.0.0.2' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xVersion: '0.0.0.2 [](start = 5, length = 18)
This is manually versioned? Is the plan to update this to an automated version update based on build date/time or? Pending work? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, if we are publishing the bundle, we should pick up the same versioning bit that we do for the binaries below. I'm just not sure why we are publishing the bundle...
In reply to: 409048697 [](ancestors = 409048697)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove the publishing step if you guys don't like it, or publish as a generic name without version
In reply to: 409049472 [](ancestors = 409049472,409048697)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
azure-pipelines.yml
Outdated
name: signingCert | ||
displayName: 'Download signing certificate' | ||
inputs: | ||
secureFile: 'AppInstallerTest.pfx' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are signing this with a "secure" certificate and publishing the artifact, I think it is time to split the pipelines into PR and CI. You can do that in this PR by just copy and edit, but in the future we should probably use the #include analog that the pipelines yaml has. #Resolved
azure-pipelines.yml
Outdated
@@ -92,7 +111,7 @@ jobs: | |||
inputs: | |||
targetType: 'inline' | |||
script: | | |||
Add-AppxPackage AppInstallerCLIPackage_0.0.0.2_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.Desktop.appx | |||
Add-AppxPackage AppInstallerCLIPackage_$(appxVersion)_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.Desktop.appx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pendencies\x64 [](start = 69, length = 14)
is this only x64? is there no x86 flavors? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that insufficient if we are publishing to x86?
In reply to: 409050687 [](ancestors = 409050687,409049574)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved as external. We can enable other flavor tests later if we decide to
In reply to: 409053586 [](ancestors = 409053586,409050687,409049574)
azure-pipelines.yml
Outdated
|
||
|
||
- task: PublishBuildArtifacts@1 | ||
displayName: Publish AppxBundle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Publish AppxBundle [](start = 17, length = 18)
Why are we publishing the bundle? #Resolved
azure-pipelines.yml
Outdated
- task: PublishBuildArtifacts@1 | ||
displayName: Publish AppxBundle | ||
inputs: | ||
PathtoPublish: '$(appxPackageDir)AppInstallerCLIPackage_$(appxVersion)_Test\AppInstallerCLIPackage_$(appxVersion)_x86_x64_ARM.appxbundle' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ARM.a [](start = 128, length = 5)
this tool runs on arm? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, ARM64 Desktop devices exist and the tool should work fine there (assuming we did good at choosing applicable architectures).
In reply to: 409050648 [](ancestors = 409050648)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests will need to run on that platform as well then...
In reply to: 409070701 [](ancestors = 409070701,409050648)
src/AppInstallerCLI.sln
Outdated
@@ -42,16 +52,19 @@ Global | |||
binver\binver.vcxitems*{fb313532-38b0-4676-9303-ab200aa13576}*SharedItemsImports = 4 | |||
EndGlobalSection | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
Debug|Any CPU = Debug|Any CPU |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
g|Any CPU = Debug|Any CPU [](start = 6, length = 25)
are we intentionally doing the any cpu JIT magic? I vaguely remember there are reasons not to #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think VS added it automatically when I added a .net core project. I can clean up
In reply to: 409052467 [](ancestors = 409052467)
@@ -223,4 +223,7 @@ | |||
<Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.191111.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.191111.2\build\native\Microsoft.Windows.CppWinRT.props'))" /> | |||
<Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.191111.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.191111.2\build\native\Microsoft.Windows.CppWinRT.targets'))" /> | |||
</Target> | |||
<Target Name="AfterBuild"> | |||
<Copy SourceFiles="$(OutDir)\$(TargetFileName)" DestinationFolder="$(SolutionDir)\AnyCPU\$(Configuration)\AppInstallerCLIE2ETests" ContinueOnError="true" /> | |||
</Target> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not likely to play well with the internal build system. I would prefer that the tests take care of finding the exe when they are run. This likely means taking in a parameter for the path to the exe, and defaulting to the local relative location from this solution. #Resolved
public const string AICLIPackagePFN = "Microsoft.VCLibs.x86.14.00.Desktop.appx"; | ||
|
||
// Todo: switch to use prod index when available | ||
public const string TestSourceUrl = @"https://pkgmgr-int.azureedge.net/cache"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@"https://pkgmgr-int.azureedge.net/cache" [](start = 44, length = 41)
I have been explicitly avoiding any references to int in the code, as it isn't intended to be public... #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline. Keep the tests for now. Add a todo to move to use index created by ourselves. In the latest change, I move the testsource url to each individual test.
In reply to: 409077020 [](ancestors = 409077020,409059513)
Assert.True(result.StdOut.Contains("9b4c49ad7e47afd97d2e666e93347745e1647c55f1a7ebba6d31b7dd5f69ee68")); | ||
|
||
// Hash msix | ||
result = TestCommon.RunAICLICommand("hash", TestCommon.GetTestDataFile("Microsoft.VCLibs.x86.14.00.Desktop.appx" + " -m")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestCommon.GetTestDataFile("Microsoft.VCLibs.x86.14.00.Desktop.appx" + " -m") [](start = 56, length = 77)
Do you mean to have the + " -m" inside of the call to GetTestDataFile? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
public class InstallCommand | ||
{ | ||
private const string InstallTestSourceUrl = @"https://github.com/microsoft/appinstaller-cli/raw/master/src/AppInstallerCLIE2ETests/TestData"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ceUrl = @"https://github.com/microsoft/appinstaller-cli/raw/master/src/AppInstallerCLIE2ETests/TestData" [](start = 44, length = 104)
Not sold on this web dependency #Pending
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. As we discussed yesterday, that's not going to be our plan. Actually I think I set this PR in draft mode, I'll clean up before set to open
In reply to: 409062452 [](ancestors = 409062452)
|
||
public class InstallCommand | ||
{ | ||
private const string InstallTestSourceUrl = @"https://github.com/microsoft/appinstaller-cli/raw/master/src/AppInstallerCLIE2ETests/TestData"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@"https://github.com/microsoft/appinstaller-cli/raw/master/src/AppInstallerCLIE2ETests/TestData"; [](start = 51, length = 98)
I assume that the goal of the tests being commented is to replace this with a local loop-back http server. #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assert.True(result.StdOut.Contains("Microsoft.PowerToys")); | ||
Assert.True(result.StdOut.Contains("Microsoft.VisualStudioCode")); | ||
|
||
// Search Microsoft with exact arg should return none |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exact arg shou [](start = 37, length = 14)
Exact arg is kinda wierd. Doesn't most lookups do this via quotes? #ByDesign
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We like exact, gives us precise control :) Anyway I'm just testing what we support now
In reply to: 409063125 [](ancestors = 409063125)
[SetUp] | ||
public void Setup() | ||
{ | ||
Assert.AreEqual(TestCommon.RunAICLICommand("source", $"add {Constants.TestSourceName} {Constants.TestSourceUrl}").ExitCode, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestSourceUrl [](start = 109, length = 13)
Search tests should probably be run against our own test source, rather than a public one. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think last time you said search test should involve some live data, right?
In reply to: 409063599 [](ancestors = 409063599)
Assert.AreEqual(result.ExitCode, Constants.ErrorCode.S_OK); | ||
Assert.True(result.StdOut.Contains("Microsoft.VisualStudioCode")); | ||
|
||
// Search through id found the app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh id found the app [](start = 26, length = 20)
is the id exposed to end users? #ByDesign
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
else | ||
{ | ||
TestCommon.AICLIPath = TestCommon.GetTestFile("AppInstallerCli.exe"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does the exe name change between packaged and not packaged? #ByDesign
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual exe file name is AppInstallerCli.exe
Appinst.exe is the app execution alias declared in manifest
In reply to: 409064119 [](ancestors = 409064119)
} | ||
|
||
// Returns whether there's a change to the dev mode state after execution | ||
private bool EnableDevMode(bool enable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EnableDevMode [](start = 21, length = 13)
As the agent doesn't seem to need this, I would prefer to just let the user know that dev mode is needed if it fails. Writing to HKLM will require running as admin... #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove this one. But running as admin is still needed since we need to install certs above
In reply to: 409065673 [](ancestors = 409065673)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm keeping this one since the certutil above requires elevated anyway. And it helps me when I run on another machine. If you really want to remove this one, please reactivate and I can remove them.
In reply to: 409085967 [](ancestors = 409085967,409065673)
Assert.AreEqual(Constants.ErrorCode.ERROR_NO_RANGES_PROCESSED, result.ExitCode); | ||
Assert.True(result.StdOut.Contains("error occurred while executing the command")); | ||
|
||
// List when source exists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following arguments are available:
-n,--name Name of the source
-a,--arg Argument given to the source
-t,--type Type of the source
What is an argument given to a source? What/when would type be used? I assume right not it is not used? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--name is source name, --arg is the root url to manifests, --type currently has only support for Microsoft.Preindexed. And it's the default. No usage for now.
In reply to: 409110894 [](ancestors = 409110894)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the help text doesnt explain that very well.
I take it these arguments can also be implicit via ordering? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3e39497
to
b08bbdb
Compare
@@ -14,7 +14,7 @@ namespace AppInstaller::CLI::Workflow | |||
// ShellExecutes the given path. | |||
std::optional<DWORD> InvokeShellExecute(const std::filesystem::path& filePath, const std::string& args, IProgressCallback& progress) | |||
{ | |||
AICLI_LOG(CLI, Info, << "Staring installer. Path: " << filePath); | |||
AICLI_LOG(CLI, Info, << "Starting installer. Path: " << filePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Starting [](start = 37, length = 8)
I think this has been fixed in 3 different PRs now... #Resolved
|
||
public class InstallCommand | ||
{ | ||
// Todo: this should point to a loopback address. Disabling the install tests until we have loopback support done in our e2e tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabling the install tests [](start = 58, length = 27)
The tests don't look like they are disabled. #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I commented out all test attributes so these tests won't run.
Or you prefer commenting out whole code block?
In reply to: 413322831 [](ancestors = 413322831)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.