From a859f73d075ec0505994d8ce0f371ec28e466983 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Tue, 13 Feb 2024 21:56:06 +0100 Subject: [PATCH 1/2] test/system: Unbreak Podman's downstream Fedora CI The paths to bats-assert and bats-support are broken, if bats(1) is invoked from any other location than the parent directory of the 'tests' directory. eg., Podman's downstream Fedora CI invokes the tests as: $ cd /path/to/toolbox/test/system $ bats . ... and it led to [1]: 1..306 # test suite: Set up # Missing dependencies # Forgot to run 'git submodule init' and 'git submodule update' ? # test suite: Tear down not ok 1 setup_suite # (from function `setup_suite' in test file ./setup_suite.bash, line 33) # `return 1' failed # bats warning: Executed 1 instead of expected 306 tests Fallout from 2c0960660330dc6be6861502988695f9812c475a [1] https://bugzilla.redhat.com/show_bug.cgi?id=2263968 https://github.com/containers/toolbox/pull/1448 --- test/system/setup_suite.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/system/setup_suite.bash b/test/system/setup_suite.bash index e4edf232bcd8..01985b7f9afc 100644 --- a/test/system/setup_suite.bash +++ b/test/system/setup_suite.bash @@ -17,7 +17,7 @@ missing_dependencies=false -if [ -f test/system/libs/bats-assert/load.bash ] && [ -f test/system/libs/bats-support/load.bash ]; then +if [ -f "$BATS_TEST_DIRNAME/libs/bats-assert/load.bash" ] && [ -f "$BATS_TEST_DIRNAME/libs/bats-support/load.bash" ]; then load 'libs/helpers' else missing_dependencies=true -- 2.43.0 From a183876eae2bb4ffd84bca4303fc28be6725ebc2 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Fri, 23 Feb 2024 10:38:16 +0100 Subject: [PATCH 2/2] test/system: Unbreak Podman's downstream Fedora CI (part 2) The working directory from which bats(1) is invoked might not be part of the Toolbx container. eg., Podman's downstream Fedora CI invokes the tests as: $ cd /path/to/toolbox/test/system $ bats . ... and it led to [1]: not ok 110 run: Smoke test with true(1) # (from function `assert_output' in file ./libs/bats-assert/src/assert.bash, line 255, # in test file ./104-run.bats, line 38) # `assert_output ""' failed # # -- output differs -- # expected (0 lines): # # actual (3 lines): # Error: crun: chdir to `/usr/share/toolbox/test/system`: No such file or directory: OCI runtime attempted to invoke a command that was not found # Error: directory /usr/share/toolbox/test/system not found in container fedora-toolbox-41 # Using /home/testuser instead. # -- # [1] https://bugzilla.redhat.com/show_bug.cgi?id=2263968 https://github.com/containers/toolbox/pull/1457 --- test/system/104-run.bats | 2 ++ test/system/201-ipc.bats | 2 ++ test/system/203-network.bats | 2 ++ test/system/206-user.bats | 2 ++ test/system/210-ulimit.bats | 2 ++ test/system/211-dbus.bats | 2 ++ test/system/220-environment-variables.bats | 2 ++ 7 files changed, 14 insertions(+) diff --git a/test/system/104-run.bats b/test/system/104-run.bats index ff11a8477062..a0cb89fdeeca 100644 --- a/test/system/104-run.bats +++ b/test/system/104-run.bats @@ -23,9 +23,11 @@ setup() { bats_require_minimum_version 1.7.0 _setup_environment cleanup_containers + pushd "$HOME" || return 1 } teardown() { + popd || return 1 cleanup_containers } diff --git a/test/system/201-ipc.bats b/test/system/201-ipc.bats index 15c791dec86d..09200b41d06c 100644 --- a/test/system/201-ipc.bats +++ b/test/system/201-ipc.bats @@ -23,9 +23,11 @@ setup() { bats_require_minimum_version 1.7.0 _setup_environment cleanup_containers + pushd "$HOME" || return 1 } teardown() { + popd || return 1 cleanup_containers } diff --git a/test/system/203-network.bats b/test/system/203-network.bats index db1ba561f314..012374e3317f 100644 --- a/test/system/203-network.bats +++ b/test/system/203-network.bats @@ -35,9 +35,11 @@ setup() { bats_require_minimum_version 1.7.0 _setup_environment cleanup_containers + pushd "$HOME" || return 1 } teardown() { + popd || return 1 cleanup_containers } diff --git a/test/system/206-user.bats b/test/system/206-user.bats index 2df7862f259e..473a6b40905a 100644 --- a/test/system/206-user.bats +++ b/test/system/206-user.bats @@ -23,9 +23,11 @@ setup() { bats_require_minimum_version 1.7.0 _setup_environment cleanup_containers + pushd "$HOME" || return 1 } teardown() { + popd || return 1 cleanup_containers } diff --git a/test/system/210-ulimit.bats b/test/system/210-ulimit.bats index ea0c46685df1..ea08feea1513 100644 --- a/test/system/210-ulimit.bats +++ b/test/system/210-ulimit.bats @@ -23,9 +23,11 @@ setup() { bats_require_minimum_version 1.7.0 _setup_environment cleanup_containers + pushd "$HOME" || return 1 } teardown() { + popd || return 1 cleanup_containers } diff --git a/test/system/211-dbus.bats b/test/system/211-dbus.bats index 295bb71b2789..61c543a56005 100644 --- a/test/system/211-dbus.bats +++ b/test/system/211-dbus.bats @@ -23,9 +23,11 @@ setup() { bats_require_minimum_version 1.7.0 _setup_environment cleanup_containers + pushd "$HOME" || return 1 } teardown() { + popd || return 1 cleanup_containers } diff --git a/test/system/220-environment-variables.bats b/test/system/220-environment-variables.bats index 5b51d17dee55..c24e07d146ee 100644 --- a/test/system/220-environment-variables.bats +++ b/test/system/220-environment-variables.bats @@ -23,9 +23,11 @@ setup() { bats_require_minimum_version 1.7.0 _setup_environment cleanup_containers + pushd "$HOME" || return 1 } teardown() { + popd || return 1 cleanup_containers } -- 2.43.0