summaryrefslogtreecommitdiff
path: root/test/system/helpers.bash
diff options
context:
space:
mode:
Diffstat (limited to 'test/system/helpers.bash')
-rw-r--r--test/system/helpers.bash22
1 files changed, 18 insertions, 4 deletions
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 415c9010e..36a88fc10 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -56,14 +56,14 @@ fi
# Setup helper: establish a test environment with exactly the images needed
function basic_setup() {
# Clean up all containers
- run_podman rm -t 0 --all --force
+ run_podman rm -t 0 --all --force --ignore
# ...including external (buildah) ones
run_podman ps --all --external --format '{{.ID}} {{.Names}}'
for line in "${lines[@]}"; do
set $line
echo "# setup(): removing stray external container $1 ($2)" >&3
- run_podman rm $1
+ run_podman rm -f $1
done
# Clean up all images except those desired
@@ -109,8 +109,8 @@ function basic_setup() {
# Basic teardown: remove all pods and containers
function basic_teardown() {
echo "# [teardown]" >&2
- run_podman '?' pod rm -t 0 --all --force
- run_podman '?' rm -t 0 --all --force
+ run_podman '?' pod rm -t 0 --all --force --ignore
+ run_podman '?' rm -t 0 --all --force --ignore
command rm -rf $PODMAN_TMPDIR
}
@@ -318,6 +318,10 @@ function wait_for_port() {
# BEGIN miscellaneous tools
# Shortcuts for common needs:
+function is_ubuntu() {
+ grep -qiw ubuntu /etc/os-release
+}
+
function is_rootless() {
[ "$(id -u)" -ne 0 ]
}
@@ -459,6 +463,16 @@ function skip_if_journald_unavailable {
fi
}
+function skip_if_root_ubuntu {
+ if is_ubuntu; then
+ if ! is_remote; then
+ if ! is_rootless; then
+ skip "Cannot run this test on rootful ubuntu, usually due to user errors"
+ fi
+ fi
+ fi
+}
+
#########
# die # Abort with helpful message
#########