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

Closed
ferventcoder opened this issue Mar 14, 2019 · 2 comments · Fixed by #2533
Closed

choco source - Exit 2 if nothing to do (enhanced exit code) #1764

ferventcoder opened this issue Mar 14, 2019 · 2 comments · 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
Copy link
Member Author

Also exit with special code when source does not exist

@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 source 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 source 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 source 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 source 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 source 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 source 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 source 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 source 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 source 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 to gep13/choco that referenced this issue May 24, 2024
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.
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
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.
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
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.
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
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.
@gep13 gep13 changed the title source - Exit 2 if nothing to do (enhanced exit code) choco source - 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