tests: Fix tests to setup the XDG_RUNTIME_DIR variable when empty
https://github.com/containers/toolbox/pull/857 When the XDG_RUNTIME_DIR variable is empty toolbox is not able to initialize the container correctly and fails to run.
This commit is contained in:
parent
09fb237727
commit
075b9a8d27
8 changed files with 18 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ load 'libs/bats-assert/load'
|
|||
load 'libs/helpers'
|
||||
|
||||
setup() {
|
||||
check_xdg_runtime_dir
|
||||
cleanup_containers
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ load 'libs/bats-assert/load'
|
|||
load 'libs/helpers'
|
||||
|
||||
setup() {
|
||||
check_xdg_runtime_dir
|
||||
cleanup_all
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ load 'libs/bats-assert/load'
|
|||
load 'libs/helpers'
|
||||
|
||||
setup() {
|
||||
check_xdg_runtime_dir
|
||||
cleanup_containers
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ load 'libs/bats-assert/load'
|
|||
load 'libs/helpers'
|
||||
|
||||
setup() {
|
||||
check_xdg_runtime_dir
|
||||
cleanup_containers
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ load 'libs/bats-assert/load'
|
|||
load 'libs/helpers'
|
||||
|
||||
setup() {
|
||||
check_xdg_runtime_dir
|
||||
cleanup_containers
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ load 'libs/bats-assert/load'
|
|||
load 'libs/helpers'
|
||||
|
||||
setup() {
|
||||
check_xdg_runtime_dir
|
||||
cleanup_all
|
||||
}
|
||||
|
||||
|
|
|
@ -270,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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue