From c65a6e06e38bad6f1f1a1139953fc112f49def33 Mon Sep 17 00:00:00 2001 From: Oliver Gutierrez Date: Fri, 3 Sep 2021 12:04:24 +0100 Subject: [PATCH] Test fixes for gating diff --git a/test/system/002-help.bats b/test/system/002-help.bats index 4ff02c6..cca3da4 100644 --- a/test/system/002-help.bats +++ b/test/system/002-help.bats @@ -4,6 +4,10 @@ load 'libs/bats-support/load' load 'libs/bats-assert/load' load 'libs/helpers.bash' +setup() { + check_xdg_runtime_dir +} + @test "help: Run command 'help'" { run $TOOLBOX help diff --git a/test/system/101-create.bats b/test/system/101-create.bats index 3cc3eaf..63d4fcb 100644 --- a/test/system/101-create.bats +++ b/test/system/101-create.bats @@ -5,6 +5,7 @@ load 'libs/bats-assert/load' load 'libs/helpers' setup() { + check_xdg_runtime_dir cleanup_containers } @@ -62,7 +63,7 @@ teardown() { assert_success assert_output --partial "Created container: fedora-toolbox-32" - assert_output --partial "Enter with: toolbox enter fedora-toolbox-32" + assert_output --partial "Enter with: toolbox enter --release 32" # Make sure the container has actually been created run podman ps -a diff --git a/test/system/102-list.bats b/test/system/102-list.bats index 184ad6c..770e8d2 100644 --- a/test/system/102-list.bats +++ b/test/system/102-list.bats @@ -5,6 +5,7 @@ load 'libs/bats-assert/load' load 'libs/helpers' setup() { + check_xdg_runtime_dir cleanup_all } diff --git a/test/system/104-run.bats b/test/system/104-run.bats index 026126b..03cf291 100644 --- a/test/system/104-run.bats +++ b/test/system/104-run.bats @@ -5,6 +5,7 @@ load 'libs/bats-assert/load' load 'libs/helpers' setup() { + check_xdg_runtime_dir cleanup_containers } diff --git a/test/system/105-rm.bats b/test/system/105-rm.bats index 9f1435b..68e3c03 100644 --- a/test/system/105-rm.bats +++ b/test/system/105-rm.bats @@ -5,6 +5,7 @@ load 'libs/bats-assert/load' load 'libs/helpers' setup() { + check_xdg_runtime_dir cleanup_containers } diff --git a/test/system/106-rmi.bats b/test/system/106-rmi.bats index 0ef0ebe..b48f802 100644 --- a/test/system/106-rmi.bats +++ b/test/system/106-rmi.bats @@ -5,6 +5,7 @@ load 'libs/bats-assert/load' load 'libs/helpers' setup() { + check_xdg_runtime_dir cleanup_all } diff --git a/test/system/libs/helpers.bash b/test/system/libs/helpers.bash index d59d661..89248fb 100644 --- a/test/system/libs/helpers.bash +++ b/test/system/libs/helpers.bash @@ -8,8 +8,7 @@ readonly TOOLBOX=${TOOLBOX:-toolbox} readonly SKOPEO=$(command -v skopeo) # Helpful globals -readonly PROJECT_DIR=${PWD} -readonly IMAGE_CACHE_DIR="${PROJECT_DIR}/image-cache" +readonly IMAGE_CACHE_DIR="${BATS_RUN_TMPDIR}/image-cache" # Images declare -Ag IMAGES=([busybox]="docker.io/library/busybox" \ @@ -271,3 +270,11 @@ function get_system_version() { echo $(awk -F= '/VERSION_ID/ {print $2}' $os_release | head -n 1) } + + +# Setup the XDG_RUNTIME_DIR variable if not set +function check_xdg_runtime_dir() { + if [[ -z "${XDG_RUNTIME_DIR}" ]]; then + export XDG_RUNTIME_DIR="/run/user/${UID}" + fi +} \ No newline at end of file -- 2.31.1