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

try() is not a variant of run() #5094

Closed
wants to merge 1 commit into from

Conversation

jandubois
Copy link
Member

It will fail with a non-zero exit code when not successful, so there is no need to assert_success after calling try without run. And while it does capture the command output in $output, that is an implementation detail that tests should not rely on; they have to call run try to set $output and $status.

Exiting with non-zero status was part of 431fa12 and outputting the command output back to stdout was implemented in d678dba.

There are 2 assert_success lines in bats/tests/helpers/vm.bash that are not removed here to avoid a merge conflict with #5090 which does already remove them.

It will fail with a non-zero exit code when not successful, so there is
no need to `assert_success` after calling `try` without `run`. And while
it does capture the command output in $output, that is an implementation
detail that tests should not rely on; they have to call `run try` to set
$output and $status.

Exiting with non-zero status was part of 431fa12 and outputting the
command output back to stdout was implemented in d678dba.

Signed-off-by: Jan Dubois <jan.dubois@suse.com>
@mook-as mook-as requested a review from IsaSih July 4, 2023 17:14
@jandubois jandubois marked this pull request as draft July 5, 2023 07:04
@jandubois
Copy link
Member Author

Commit has been included in #5160.

@jandubois jandubois closed this Jul 18, 2023
@jandubois jandubois deleted the bats-try branch July 18, 2023 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant