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

choco feature - Exit 2 if nothing to do (enhanced exit code) #1761

Closed
ferventcoder opened this issue Mar 14, 2019 · 1 comment · Fixed by #2533
Closed

choco feature - Exit 2 if nothing to do (enhanced exit code) #1761

ferventcoder opened this issue Mar 14, 2019 · 1 comment · Fixed by #2533
Assignees
Milestone

Comments

@ferventcoder
Copy link
Member

Related to #1758

@ferventcoder ferventcoder modified the milestones: 0.10.13, 0.10.14 Mar 14, 2019
@ferventcoder ferventcoder modified the milestones: 0.10.14, 0.10.15 Apr 1, 2019
@gep13 gep13 modified the milestones: 0.10.15, 0.10.16 May 31, 2019
@ferventcoder ferventcoder modified the milestones: 0.10.16, 0.10.17 Jan 14, 2020
@ferventcoder ferventcoder modified the milestones: 0.10.17, 0.10.x Apr 14, 2021
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jan 17, 2022
If enhanced exit codes are enabled, this sets the feature command to
exit with 2 if there is nothing to do (i.e. if NOCHANGEMESSAGE is
output).
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Mar 21, 2022
If enhanced exit codes are enabled, this sets the feature command to
exit with 2 if there is nothing to do (i.e. if NOCHANGEMESSAGE is
output).
@vexx32 vexx32 modified the milestones: 0.11.x, Future, Future_ Apr 1, 2022
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jun 27, 2022
If enhanced exit codes are enabled, this sets the feature command to
exit with 2 if there is nothing to do (i.e. if NOCHANGEMESSAGE is
output).
@TheCakeIsNaOH TheCakeIsNaOH self-assigned this Jul 30, 2022
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Dec 22, 2022
If enhanced exit codes are enabled, this sets the feature command to
exit with 2 if there is nothing to do (i.e. if NOCHANGEMESSAGE is
output).
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jun 16, 2023
If enhanced exit codes are enabled, this sets the feature command to
exit with 2 if there is nothing to do (i.e. if NOCHANGEMESSAGE is
output).
@gep13 gep13 modified the milestones: Future, 2.3.0 Dec 14, 2023
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jan 10, 2024
If enhanced exit codes are enabled, this sets the feature command to
exit with 2 if there is nothing to do (i.e. if NOCHANGEMESSAGE is
output).
gep13 pushed a commit to TheCakeIsNaOH/choco that referenced this issue Apr 19, 2024
If enhanced exit codes are enabled, this sets the feature command to
exit with 2 if there is nothing to do (i.e. if NOCHANGEMESSAGE is
output).
gep13 added a commit to TheCakeIsNaOH/choco that referenced this issue Apr 23, 2024
Within the following issues, a number of changes were made to allow
Chocolatey CLI to exit with a ExitCode of 2, when no action was taken:

chocolatey#2200 - Upgrade
chocolatey#1764 - Source
chocolatey#1762 - Pin
chocolatey#1761 - Feature
chocolatey#1760 - Config
chocolatey#1759 - ApiKey

This commit adds the unit tests to exercise these changes to ensure
that they work as expected, and also that they continue to work as
additional changes are made.

No new test files have been created in this commit, but rather test
were added to existing test files.

The tests that have been added are a carbon copy of each other, to an
extent, i.e. setup and run the required action, then assert the logs
and ExitCode of 0.  Then enable the UseEnhancedExitCodes feature and
run the action again and assert the logs and ExitCode of 2.

One change was made to the TinySpec file to ensure that the
Environment.ExitCode is set to 0 (default) at the start of each test
execution.  This was required due to the fact that some test executions
result in the ExitCode being set to 2 explicitly, but the next test
didn't set it to 0, due to the fact that it relies on the default value
being returned.  Since this is a concern across all test executions,
the decision was made to put it into the TinySpec file.
gep13 pushed a commit to TheCakeIsNaOH/choco that referenced this issue Apr 23, 2024
If enhanced exit codes are enabled, this sets the feature command to
exit with 2 if there is nothing to do (i.e. if NOCHANGEMESSAGE is
output).
gep13 added a commit to TheCakeIsNaOH/choco that referenced this issue Apr 23, 2024
Within the following issues, a number of changes were made to allow
Chocolatey CLI to exit with a ExitCode of 2, when no action was taken:

chocolatey#2200 - Upgrade
chocolatey#1764 - Source
chocolatey#1762 - Pin
chocolatey#1761 - Feature
chocolatey#1760 - Config
chocolatey#1759 - ApiKey

This commit adds the unit tests to exercise these changes to ensure
that they work as expected, and also that they continue to work as
additional changes are made.

No new test files have been created in this commit, but rather test
were added to existing test files.

The tests that have been added are a carbon copy of each other, to an
extent, i.e. setup and run the required action, then assert the logs
and ExitCode of 0.  Then enable the UseEnhancedExitCodes feature and
run the action again and assert the logs and ExitCode of 2.

One change was made to the TinySpec file to ensure that the
Environment.ExitCode is set to 0 (default) at the start of each test
execution.  This was required due to the fact that some test executions
result in the ExitCode being set to 2 explicitly, but the next test
didn't set it to 0, due to the fact that it relies on the default value
being returned.  Since this is a concern across all test executions,
the decision was made to put it into the TinySpec file.
gep13 added a commit to TheCakeIsNaOH/choco that referenced this issue Apr 23, 2024
Within the following issues, a number of changes were made to allow
Chocolatey CLI to exit with a ExitCode of 2, when no action was taken:

chocolatey#2200 - Upgrade
chocolatey#1764 - Source
chocolatey#1762 - Pin
chocolatey#1761 - Feature
chocolatey#1760 - Config
chocolatey#1759 - ApiKey

This commit adds the unit tests to exercise these changes to ensure
that they work as expected, and also that they continue to work as
additional changes are made.

No new test files have been created in this commit, but rather test
were added to existing test files.

The tests that have been added are a carbon copy of each other, to an
extent, i.e. setup and run the required action, then assert the logs
and ExitCode of 0.  Then enable the UseEnhancedExitCodes feature and
run the action again and assert the logs and ExitCode of 2.

One change was made to the TinySpec file to ensure that the
Environment.ExitCode is set to 0 (default) at the start of each test
execution.  This was required due to the fact that some test executions
result in the ExitCode being set to 2 explicitly, but the next test
didn't set it to 0, due to the fact that it relies on the default value
being returned.  Since this is a concern across all test executions,
the decision was made to put it into the TinySpec file.
gep13 added a commit to TheCakeIsNaOH/choco that referenced this issue Apr 23, 2024
Within the following issues, a number of changes were made to allow
Chocolatey CLI to exit with a ExitCode of 2, when no action was taken:

chocolatey#2200 - Upgrade
chocolatey#1764 - Source
chocolatey#1762 - Pin
chocolatey#1761 - Feature
chocolatey#1760 - Config
chocolatey#1759 - ApiKey

This commit adds the unit tests to exercise these changes to ensure
that they work as expected, and also that they continue to work as
additional changes are made.

No new test files have been created in this commit, but rather test
were added to existing test files.

The tests that have been added are a carbon copy of each other, to an
extent, i.e. setup and run the required action, then assert the logs
and ExitCode of 0.  Then enable the UseEnhancedExitCodes feature and
run the action again and assert the logs and ExitCode of 2.

One change was made to the TinySpec file to ensure that the
Environment.ExitCode is set to 0 (default) at the start of each test
execution.  This was required due to the fact that some test executions
result in the ExitCode being set to 2 explicitly, but the next test
didn't set it to 0, due to the fact that it relies on the default value
being returned.  Since this is a concern across all test executions,
the decision was made to put it into the TinySpec file.
gep13 pushed a commit to TheCakeIsNaOH/choco that referenced this issue Apr 23, 2024
If enhanced exit codes are enabled, this sets the feature command to
exit with 2 if there is nothing to do (i.e. if NOCHANGEMESSAGE is
output).
gep13 added a commit to TheCakeIsNaOH/choco that referenced this issue Apr 23, 2024
Within the following issues, a number of changes were made to allow
Chocolatey CLI to exit with a ExitCode of 2, when no action was taken:

chocolatey#2200 - Upgrade
chocolatey#1764 - Source
chocolatey#1762 - Pin
chocolatey#1761 - Feature
chocolatey#1760 - Config
chocolatey#1759 - ApiKey

This commit adds the unit tests to exercise these changes to ensure
that they work as expected, and also that they continue to work as
additional changes are made.

No new test files have been created in this commit, but rather test
were added to existing test files.

The tests that have been added are a carbon copy of each other, to an
extent, i.e. setup and run the required action, then assert the logs
and ExitCode of 0.  Then enable the UseEnhancedExitCodes feature and
run the action again and assert the logs and ExitCode of 2.

One change was made to the TinySpec file to ensure that the
Environment.ExitCode is set to 0 (default) at the start of each test
execution.  This was required due to the fact that some test executions
result in the ExitCode being set to 2 explicitly, but the next test
didn't set it to 0, due to the fact that it relies on the default value
being returned.  Since this is a concern across all test executions,
the decision was made to put it into the TinySpec file.
@gep13 gep13 added 4 - Done and removed 3 - Review labels Apr 23, 2024
gep13 added a commit that referenced this issue May 21, 2024
When we introduced the concept of an enhanced exit code for the choco
feature command, we didn't update the Pester tests that are explicitly
looking for an exit code of 0 when running the choco feature command.

In some circumstances, the useEnhancedExitCodes feature of Chocolatey
CLi is enabled, and the exit code can be 2, rather than 0, so the
assertion had to be updated to use -notin, rather than a straight -ne.

In addition, the output of the Write-Host was changed to made it
clearer that the exit code was actually the exit code, and that the
Chocolatey Output fro the executing command was what it said it was.
gep13 added a commit to gep13/choco that referenced this issue May 24, 2024
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.
corbob pushed a commit to gep13/choco that referenced this issue May 27, 2024
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.
gep13 added a commit to gep13/choco that referenced this issue May 28, 2024
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.
gep13 added a commit to gep13/choco that referenced this issue May 30, 2024
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.
@gep13 gep13 changed the title feature - Exit 2 if nothing to do (enhanced exit code) choco feature - Exit 2 if nothing to do (enhanced exit code) May 30, 2024
@choco-bot
Copy link

🎉 This issue has been resolved in version 2.3.0 🎉

The release is available on:

Your GitReleaseManager bot 📦 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants