Skip to content

Commit 978bb52

Browse files
committed
test/system: Silence warning with Bats >= 1.7.0
Bats 1.7.0 emits a warning if a command passed to 'run' returns with an exit code of 127 [1]: BW01: `run`'s command `/opt/bin/toolbox run non-existent-command` exited with code 127, indicating 'Command not found'. Use run's return code checks, e.g. `run -127`, to fix this message. (from function `run' in file /usr/lib/bats-core/test_functions.bash, line 299, in test file test/system/104-run.bats, line 148) This requires Bats >= 1.5.0, which is present in Fedora >=35, and supports specifying the exit code as an argument to Bats' 'run' command [2]. However, bats_require_minimum_version can't be used, because it's only available from Bats 1.7.0, which is new enough that it's absent from Fedora 35. [1] Bats commit c6dc2f88361a4f5b bats-core/bats-core#547 https://bats-core.readthedocs.io/en/stable/warnings/BW01.html [2] bats-core/bats-core#367 bats-core/bats-core#507 https://bats-core.readthedocs.io/en/stable/writing-tests.html [3] Bats commit 71d6b71cebc3d32b bats-core/bats-core#556 https://bats-core.readthedocs.io/en/stable/warnings/BW02.html #1081
1 parent 03daa86 commit 978bb52

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/system/104-run.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ teardown() {
145145

146146
create_default_container
147147

148-
run $TOOLBOX run $cmd
148+
run -127 $TOOLBOX run $cmd
149149

150150
assert_failure
151151
assert [ $status -eq 127 ]

0 commit comments

Comments
 (0)