From a6f6a41a731d998a0d22f963106e557e9633be87 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 1 Apr 2022 15:28:53 +0200 Subject: [PATCH] test: skip rootless on cgroupv2 in root env the test needs to run as rootless, skip it when running in a root environment. Closes: https://github.com/containers/buildah/issues/3884 Signed-off-by: Giuseppe Scrivano --- tests/helpers.bash | 9 +++++++++ tests/run.bats | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/helpers.bash b/tests/helpers.bash index 2bb6b4293ea..c56eee7e5ef 100644 --- a/tests/helpers.bash +++ b/tests/helpers.bash @@ -456,6 +456,15 @@ function skip_if_rootless_environment() { fi } +################################# +# skip_if_root_environment # +################################# +function skip_if_root_environment() { + if ! is_rootless; then + skip "${1:-test is being invoked from root environment}" + fi +} + #################### # skip_if_chroot # #################### diff --git a/tests/run.bats b/tests/run.bats index 3fd5d4ffa7e..e2f3b6d9b95 100644 --- a/tests/run.bats +++ b/tests/run.bats @@ -783,8 +783,9 @@ _EOF skip_if_no_runtime skip_if_cgroupsv1 skip_if_in_container + skip_if_root_environment if test "$DBUS_SESSION_BUS_ADDRESS" = ""; then - skip "${1:-test does not work when \$BUILDAH_ISOLATION = chroot}" + skip "$test does not work when DBUS_SESSION_BUS_ADDRESS is not defined" fi _prefetch alpine