-
Notifications
You must be signed in to change notification settings - Fork 891
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 Pester tests to cover functionality added in Chocolatey CLI 2.3.0 #3452
Conversation
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.
@gep13 there is nothing here that absolutely must be changed, so I'm going to add an approval on here. I'll hold off on merging it until we can have a discussion on Monday, or you can merge it before that if desired.
The 2 suggested changes I included, are not blockers, the tests should work just fine whether it's changed or not. And the third comment is specifically to draw your attention to a change I added so that Test Kitchen can run the tests successfully.
@gep13 I've switched this over to draft, and force pushed a rebase with an additional troubleshooting commit. draft is so we don't merge it without removing the troubleshooting commit. I'll link you the Team City build in Slack when it starts. |
Now, when you have useEnhancedExitCodes turned on, if you try to set a pin on a package, that is already set, the exit code will change to be a 2, giving a clear indication that no action was taken. This commit adds a Pester test to verify that this works as expected.
Now, when you have useEnhancedExitCodes turned on, if you try to enable/disable a feature that is already in the desired state, the exit code will change to be a 2, giving a clear indication that no action was taken. This commit adds a Pester test to verify that this works as expected.
Now, when you have useEnhancedExitCodes turned on, if you try to add an apikey when it is already added the exit code will change to be a 2, giving a clear indication that no action was taken. This commit adds a Pester test to verify that this works as expected.
Now, when you have useEnhancedExitCodes turned on, if you try to unset a config value that doesn't exist, or try to set a config value where the value is already set to that value, the exit code will change to be a 2, giving a clear indication that no action was taken. This commit adds a Pester test to verify that this works as expected.
Now, when you have useEnhancedExitCodes turned on, if you try to add an already existing source, remove a source that doesn't exist, disable a source that is already disabled, or enable a source that is already enabled, the exit code will change to be a 2, giving a clear indication that no action was taken. This commit adds a Pester test to verify that this works as expected.
Now, when you have useEnhancedExitCodes turned on, if you try to upgrade a package, whether directly, or via the all keyword, and there are no upgrade available, the exit code will change to be a 2, giving a clear indication that no action was taken. This commit adds a Pester test to verify that this works as expected.
This commit adds some Pester tests to ensure that any attempts to run the choco install all command is correctly handled when targeting an alternative source. This is simply asserting that there is an error exit code, and that the correct output is displayed. Some of the new tests are specifically set to only run on Test-Kitchen, as there is the potential for changes to happen on the host machine, and we don't want to impact people.
Remembered arguments can now be displayed when running the choco info command, using the --local-only option. This commit adds a test to verify that this is correctly shown.
Something has changed in the output that is coming back from the CCR when pushing a package, and that package fails. It is not immediately clear what has changed, but the assertions are being updated to allow the tests to pass, and we can monitor this going forward to see if something changes again.
In these release, it is now possible to include already configured sources, i.e. in the chocolatey.config file, using an option on the info, install, outdated, search, and upgrade commands. This commit adds tests to cover these being included.
In the next release, when possible, Chocolatey CLI will now include package hash validation to ensure that the package being installed is the one that the server thinks it is. This is a feature flag that needs to be toggled on. This commit adds tests to cover that hash validation is being attempted when it can be.
The next release includes a new choco rule command, that allows displaying information about the validation rules that are currently in use by Chocolatey CLI. This commit adds basic Pester tests for exercising this command, along with its subcommands.
With the next release of Chocolatey CLI, it is possible to run choco upgrade --ignore-pinned, rather than first having to run a choco pin remove command. This commit adds a Pester test to cover the usage of the --ignore-pinned option on the upgrade command. This tests relies on correct execution of the --pin option on the install command, but this is tested elsewhere.
Attempting to fix Pester tests on Test-Kitchen during pairing session with Cory.
Previous changes for this issue had issues loading in powershell v2, this fixes those to the extent it's possible to do so.
Fix up Set-EnvironmentVariable and Update-SessionEnvironment tests.
PowerShell V2 is no longer supported. With the change to compiled cmdlets, these will not work on any system that doesn't have PowerShell v3 or newer due to the .Net Framework used. This removes the tests as they will be unable to load the compiled cmdlets and fail the tests.
We noticed over the last few days that the previous version of this code was *adding* blank values into the registry, which caused some issues with how environment variables are applied to new processes. Specifically, if a Machine-level variable is set, and a User-level variable by the same name is set to a blank value, new processes do not properly inherit the Machine-level value and it remains blank/unset. This change ensures that if someone sets an environment variable to a blank value, it will be properly *deleted* rather than set to a blank value. Additionally, a minor change has been made to Update-SessionEnvironment to ensure that if there are somehow blank values in the registry, it can sidestep those issues if it is called.
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.
Just a couple of changes, and then I think we're good to merge.
Description Of Changes
A number of new Pester tests have been added to cover functionality that has been added.
Motivation and Context
A lot of new functionality has been added into the develop branch ahead of the 2.3.0 CLI release.
We need to add tests to verify all of this new functionality, and to ensure that there are no regressions going forward.
This also includes a minor bugfix for an issue that surfaced in our test environment.
Testing
These tests have been validated locally, but we will also kick off some tests runs once this PR is raised.
Change Types Made
Change Checklist
Related Issue
N/A