run: don't change the value of i#727
Merged
martin-schulze-vireso merged 1 commit intobats-core:masterfrom May 25, 2023
Merged
Conversation
aab64d3 to
f648b53
Compare
kolyshkin
added a commit
to kolyshkin/cri-o
that referenced
this pull request
May 25, 2023
Instead of using run cmd [ "$status" -ne 0 ] since bats 1.5.0 we can use a simple form: run ! cmd Alas, bats has a bug which makes it change the value of "i" when run is used with any options ([1], [2]). To workaround that, we should not use "i" in any code which uses "run" with options. I know, this is crazy. [1] bats-core/bats-core#726 [2] bats-core/bats-core#727 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
kolyshkin
added a commit
to kolyshkin/cri-o
that referenced
this pull request
May 25, 2023
Instead of using run cmd [ "$status" -ne 0 ] since bats 1.5.0 we can use a simple form: run ! cmd Alas, bats has a bug which makes it change the value of "i" when run is used with any options ([1], [2]). To workaround that, we should not use "i" in any code which uses "run" with options. I know, this is crazy. [1] bats-core/bats-core#726 [2] bats-core/bats-core#727 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
martin-schulze-vireso
approved these changes
May 25, 2023
Contributor
Author
|
Adding a test case is useless, of course, since next time someone will change |
kolyshkin
added a commit
to kolyshkin/cri-o
that referenced
this pull request
May 25, 2023
Instead of using run cmd [ "$status" -ne 0 ] since bats 1.5.0 we can use a simple form: run ! cmd Alas, bats has a bug which makes it change the value of "i" when run is used with any options ([1], [2]). To workaround that, we should not use "i" in any code which uses "run" with options. I know, this is crazy. [1] bats-core/bats-core#726 [2] bats-core/bats-core#727 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
|
One failure in CI (no idea if related in any way); |
Member
|
It seems the output from mktemp changed (again) in alpine. I fixed the test expecation in bats-core/bats-file@c0f822a |
I came across an interesting bug today. A very simple test code stopped working properly once I changed "run" followed by the $status check to "run !". See bats-core#726 for a repro. The fix is to always declare your variables. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
f648b53 to
502dc47
Compare
Member
|
Thanks for your contribution. |
kolyshkin
added a commit
to kolyshkin/cri-o
that referenced
this pull request
May 30, 2023
Instead of using run cmd [ "$status" -ne 0 ] since bats 1.5.0 we can use a simple form: run ! cmd Alas, bats has a bug which makes it change the value of "i" when run is used with any options ([1], [2]). To workaround that, we should not use "i" in any code which uses "run" with options. I know, this is crazy. [1] bats-core/bats-core#726 [2] bats-core/bats-core#727 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I came across an interesting bug today. A very simple test code stopped working properly once I changed "run" followed by the $status check to "run !".
Fixes: #726 (see for a repro).
The fix is to always declare your variables.