-
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
Support for PowerShell cmdlets in admin mode #2642
Merged
Merged
Changes from 8 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
6307854
save work
00c91f1
Merge branch 'master' of https://github.com/ryfu-msft/winget-cli into…
ccaa1dc
save work
e3dda96
save work
4d732c2
add E2E tests for powershell module
0febd74
revert unnecessary changes
0a11caa
fix build issues
6813160
try again
f1d7b45
address PR comments
74414ae
fix build issues
71633e0
set execution policy
adc0c05
try again
bd96353
fix spacing
04524b6
run module in powershell task
0b68135
install test package
7626067
enable verbose logging
a7a8c78
fix x86 and add error code to output
9fe098e
fix path
b9d7aff
copy winrt act properly
ddb488b
fix x86 build output
987fad6
add com tracing
f0836e6
continue on error
9590eae
comment out e2e tests
ecd46bd
always run task
d1e55e7
publish appx package
708e082
Enable logging for com
0809143
try different order
1ca4064
remove explicity fail error
5075f5b
try again
8a9b956
revert all changes
8f68d4d
uncomment tests
cf5a0ef
remove teardown form powershell module test
b149685
remove unnecessary changes
eabc286
fix powershell module e2e test
d4c466f
separate powershell tests
38a20af
Fix E2E tests
6918fb9
rejoin powershell tests
3ff22d1
fix binskim
b66ebb7
Address PR comments
e1aeb9e
resolve merge conflicts
6f4885b
fix path in project file
3c19802
respond to PR feedback
9957cd8
fix build dependencies
190a6b9
fix manual reset event
a305bab
fix build warnings and errors
5a9d0a2
revert flags parameter
ffef20d
Merge branch 'master' of https://github.com/ryfu-msft/winget-cli into…
7b1362a
fix spelling
9d587c8
more spelling
4ff0887
even more spelling
0d4edb0
remove Reset event
bb04705
fix line spacing
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
src/AppInstallerCLIE2ETests/PowerShell/PowerShellModule.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
namespace AppInstallerCLIE2ETests | ||
{ | ||
using NUnit.Framework; | ||
|
||
/// <summary> | ||
/// Basic E2E tests for verifying that behavior of the PowerShell module cmdlets. | ||
/// </summary> | ||
public class PowerShellModule | ||
{ | ||
[OneTimeSetUp] | ||
public void Setup() | ||
{ | ||
// Add-WinGetPackage is a function and not a cmdlet that uses COM. Add source to WinGetDev directly to ensure test source exists. | ||
TestCommon.RunAICLICommand("source add", $"-n {Constants.TestSourceName} {Constants.TestSourceUrl}"); | ||
} | ||
|
||
[OneTimeTearDown] | ||
public void TearDown() | ||
{ | ||
// Remove-WinGetPackage is a function and not a cmdlet that uses COM. Remove source from WinGetDev directory to ensure clean state. | ||
TestCommon.RunAICLICommand("source remove", $"-n {Constants.TestSourceName}"); | ||
} | ||
|
||
[Test] | ||
public void GetWinGetSource() | ||
{ | ||
var getSourceResult = TestCommon.RunPowerShellCommandWithResult(Constants.GetSourceCmdlet, $"-Name {Constants.TestSourceName}"); | ||
Assert.IsTrue(getSourceResult.ExitCode == 0); | ||
Assert.IsTrue(getSourceResult.StdOut.Contains($"{Constants.TestSourceName}")); | ||
} | ||
|
||
[Test] | ||
public void FindWinGetPackage() | ||
{ | ||
var result = TestCommon.RunPowerShellCommandWithResult(Constants.FindCmdlet, $"-Id {Constants.ExeInstallerPackageId}"); | ||
Assert.IsTrue(result.ExitCode == 0); | ||
Assert.IsTrue(result.StdOut.Contains("TestExeInstaller")); | ||
} | ||
|
||
[Test] | ||
public void GetWinGetPackage() | ||
{ | ||
var installResult = TestCommon.RunPowerShellCommandWithResult(Constants.InstallCmdlet, $"-Id {Constants.MsiInstallerPackageId}"); | ||
var getResult = TestCommon.RunPowerShellCommandWithResult(Constants.GetCmdlet, $"-Id {Constants.MsiInstallerPackageId}"); | ||
var uninstallResult = TestCommon.RunPowerShellCommandWithResult(Constants.UninstallCmdlet, $"-Id {Constants.MsiInstallerPackageId}"); | ||
|
||
Assert.IsTrue(installResult.ExitCode == 0); | ||
Assert.IsTrue(getResult.ExitCode == 0); | ||
Assert.IsTrue(uninstallResult.ExitCode == 0); | ||
|
||
Assert.IsTrue(!string.IsNullOrEmpty(installResult.StdOut)); | ||
Assert.IsTrue(getResult.StdOut.Contains("TestMsiInstaller")); | ||
Assert.IsTrue(!string.IsNullOrEmpty(uninstallResult.StdOut)); | ||
} | ||
|
||
[Test] | ||
public void InstallWinGetPackage() | ||
{ | ||
var installResult = TestCommon.RunPowerShellCommandWithResult(Constants.InstallCmdlet, $"-Id {Constants.ExeInstallerPackageId}"); | ||
var uninstallResult = TestCommon.RunPowerShellCommandWithResult(Constants.UninstallCmdlet, $"-Id {Constants.ExeInstallerPackageId}"); | ||
|
||
Assert.IsTrue(installResult.ExitCode == 0); | ||
Assert.IsTrue(uninstallResult.ExitCode == 0); | ||
|
||
Assert.IsTrue(!string.IsNullOrEmpty(installResult.StdOut)); | ||
Assert.IsTrue(!string.IsNullOrEmpty(uninstallResult.StdOut)); | ||
} | ||
|
||
[Test] | ||
public void UpdateWinGetPackage() | ||
{ | ||
var installResult = TestCommon.RunPowerShellCommandWithResult(Constants.InstallCmdlet, $"-Id {Constants.ExeInstallerPackageId} -Version 1.0.0.0"); | ||
var updateResult = TestCommon.RunPowerShellCommandWithResult(Constants.UpdateCmdlet, $"-Id {Constants.ExeInstallerPackageId}"); | ||
var getResult = TestCommon.RunPowerShellCommandWithResult(Constants.GetCmdlet, $"-Id {Constants.ExeInstallerPackageId}"); | ||
var uninstallResult = TestCommon.RunPowerShellCommandWithResult(Constants.UninstallCmdlet, $"-Id {Constants.ExeInstallerPackageId}"); | ||
|
||
Assert.IsTrue(installResult.ExitCode == 0); | ||
Assert.IsTrue(updateResult.ExitCode == 0); | ||
Assert.IsTrue(getResult.ExitCode == 0); | ||
Assert.IsTrue(uninstallResult.ExitCode == 0); | ||
|
||
Assert.IsTrue(!string.IsNullOrEmpty(installResult.StdOut)); | ||
Assert.IsTrue(!string.IsNullOrEmpty(updateResult.StdOut)); | ||
Assert.IsTrue(getResult.StdOut.Contains("2.0.0.0")); | ||
Assert.IsTrue(!string.IsNullOrEmpty(uninstallResult.StdOut)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does this require changes in AppInstaller manifest or this is just for dev testing