From 1e90c721858b3119702b93445f535f9c23af88e6 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Wed, 2 Oct 2024 22:43:37 +0200 Subject: [PATCH] test/system: Unbreak the downstream Fedora CI The working directory from which bats(1) is invoked might not be part of the Toolbx container. eg., the downstream Fedora CI invokes the tests as: $ cd /path/to/toolbox/test/system $ bats . ... and it led to: not ok 8 help: Try unknown command (forwarded to host) # tags: commands-options # (from function `assert_line' in file ./libs/bats-assert/src/assert.bash, line 488, # in test file ./002-help.bats, line 135) # `assert_line --index 0 "Error: unknown command \"foo\" for \"toolbox\""' failed # # -- line differs -- # index : 0 # expected : Error: unknown command "foo" for "toolbox" # actual : 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 # -- # https://github.com/containers/toolbox/pull/1560 --- test/system/002-help.bats | 2 ++ test/system/501-create.bats | 2 ++ test/system/504-run.bats | 2 ++ test/system/505-enter.bats | 2 ++ 4 files changed, 8 insertions(+) diff --git a/test/system/002-help.bats b/test/system/002-help.bats index 57e918a04d22..a8bfbc2c79d2 100644 --- a/test/system/002-help.bats +++ b/test/system/002-help.bats @@ -25,9 +25,11 @@ setup() { bats_require_minimum_version 1.10.0 _setup_environment cleanup_all + pushd "$HOME" || return 1 } teardown() { + popd || return 1 cleanup_all } diff --git a/test/system/501-create.bats b/test/system/501-create.bats index 3f50f98e6bf3..cfb676b7001b 100644 --- a/test/system/501-create.bats +++ b/test/system/501-create.bats @@ -25,9 +25,11 @@ setup() { bats_require_minimum_version 1.8.0 _setup_environment cleanup_all + pushd "$HOME" || return 1 } teardown() { + popd || return 1 cleanup_all } diff --git a/test/system/504-run.bats b/test/system/504-run.bats index cc5f6fa8bb09..6ee3e86af1ff 100644 --- a/test/system/504-run.bats +++ b/test/system/504-run.bats @@ -25,9 +25,11 @@ setup() { bats_require_minimum_version 1.8.0 _setup_environment cleanup_all + pushd "$HOME" || return 1 } teardown() { + popd || return 1 cleanup_all } diff --git a/test/system/505-enter.bats b/test/system/505-enter.bats index 405d184f145e..57e58651623d 100644 --- a/test/system/505-enter.bats +++ b/test/system/505-enter.bats @@ -25,9 +25,11 @@ setup() { bats_require_minimum_version 1.8.0 _setup_environment cleanup_all + pushd "$HOME" || return 1 } teardown() { + popd || return 1 cleanup_all } -- 2.46.1