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 upgrade - Exit 2 if nothing to do (enhanced exit code) #2200

Closed
ferventcoder opened this issue Feb 17, 2021 · 2 comments · Fixed by #2533
Closed

choco upgrade - Exit 2 if nothing to do (enhanced exit code) #2200

ferventcoder opened this issue Feb 17, 2021 · 2 comments · Fixed by #2533

Comments

@ferventcoder
Copy link
Member

ferventcoder commented Feb 17, 2021

Related to #1758

If there is nothing upgraded, then choco should exit 2.

@ferventcoder
Copy link
Member Author

Putting this into the same milestone as others.

@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 upgrade command to
exit with 2 if there is nothing to do (i.e. if no packages are
upgraded).

This entails returning the number of successful package results from
the report_action_summary. This is returned as a Tuple, which is not
ideal as it's members are not named, but this should be able to be
switched to named members after this is uplifted to .Net 4.7 or higher.
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Mar 21, 2022
If enhanced exit codes are enabled, this sets the upgrade command to
exit with 2 if there is nothing to do (i.e. if no packages are
upgraded).

This entails returning the number of successful package results from
the report_action_summary. This is returned as a Tuple, which is not
ideal as it's members are not named, but this should be able to be
switched to named members after this is uplifted to .Net 4.7 or higher.
@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 upgrade command to
exit with 2 if there is nothing to do (i.e. if no packages are
upgraded).

This entails returning the number of successful package results from
the report_action_summary. This is returned as a Tuple, which is not
ideal as it's members are not named, but this should be able to be
switched to named members after this is uplifted to .Net 4.7 or higher.
@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 upgrade command to
exit with 2 if there is nothing to do (i.e. if no packages are
upgraded).

This entails returning the number of successful package results from
the report_action_summary. This is returned as a Tuple, which is not
ideal as it's members are not named, but this should be able to be
switched to named members after this is uplifted to .Net 4.7 or higher.
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jun 16, 2023
If enhanced exit codes are enabled, this sets the upgrade command to
exit with 2 if there is nothing to do (i.e. if no packages are
upgraded). This entails returning the number of successful package
results from the report_action_summary method.
@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 upgrade command to
exit with 2 if there is nothing to do (i.e. if no packages are
upgraded). This entails returning the number of successful package
results from the report_action_summary method.
gep13 pushed a commit to TheCakeIsNaOH/choco that referenced this issue Apr 19, 2024
If enhanced exit codes are enabled, this sets the upgrade command to
exit with 2 if there is nothing to do (i.e. if no packages are
upgraded). This entails returning the number of successful package
results from the report_action_summary method.
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 upgrade command to
exit with 2 if there is nothing to do (i.e. if no packages are
upgraded). This entails returning the number of successful package
results from the report_action_summary method.
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 upgrade command to
exit with 2 if there is nothing to do (i.e. if no packages are
upgraded). This entails returning the number of successful package
results from the report_action_summary method.
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 to gep13/choco that referenced this issue May 24, 2024
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.
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
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.
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
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.
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
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.
@gep13 gep13 changed the title upgrade - Exit 2 if nothing to do (enhanced exit code) choco upgrade - Exit 2 if nothing to do (enhanced exit code) May 30, 2024
gep13 added a commit that referenced this issue Jun 5, 2024
* release/2.3.0: (153 commits)
  (#23) Move call to SetRemotePackageNamesIfAllSpecified
  (#1901) Revert commit to display location
  (maint) Update Authenticode Signature
  (tests) Some minor tweaks for test consistency
  (#310) Set-EnvironmentVariable: delete values properly
  (tests) Remove v2 import tests
  (#310) Fix test issues
  (#310) Fixup v2 compatibility
  (tests) Working on tests during pairing session
  (#2050) Add Pester test for --ignore-pinned option
  (#3381) Add Pester tests for rule command
  (#1144) Add Pester test to cover hash validation
  (#72) Add Pester tests to cover new functionality
  (test) Update assertions for push commands
  (#1310) Add Pester test to validate output
  (#23) Add tests to handle install all
  (#2200) Add test for new enhanced exit code
  (#1764) Add test for new enhanced exit code
  (#1760) Add test for new enhanced exit code
  (#1759) Add test for new enhanced exit code
  ...
@choco-bot
Copy link

🎉 This issue has been resolved in version 2.3.0 🎉

The release is available on:

Your GitReleaseManager bot 📦 🚀

gep13 added a commit that referenced this issue Jun 5, 2024
* master: (37 commits)
  (#310) Fix path to chocolatey.lib files
  (maint) Corrected casing of file
  (#23) Move call to SetRemotePackageNamesIfAllSpecified
  (#1901) Revert commit to display location
  (maint) Update Authenticode Signature
  (tests) Some minor tweaks for test consistency
  (#310) Set-EnvironmentVariable: delete values properly
  (tests) Remove v2 import tests
  (#310) Fix test issues
  (#310) Fixup v2 compatibility
  (tests) Working on tests during pairing session
  (#2050) Add Pester test for --ignore-pinned option
  (#3381) Add Pester tests for rule command
  (#1144) Add Pester test to cover hash validation
  (#72) Add Pester tests to cover new functionality
  (test) Update assertions for push commands
  (#1310) Add Pester test to validate output
  (#23) Add tests to handle install all
  (#2200) Add test for new enhanced exit code
  (#1764) Add test for new enhanced exit code
  ...
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