summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLuca Bruno <luca.bruno@coreos.com>2022-11-22 16:30:50 +0000
committerGitHub <noreply@github.com>2022-11-22 16:30:50 +0000
commitf79c7a0a0adf4e7a3795ee60eb3d78c5b94c265e (patch)
tree0e45b747ab6fa59c1f6d0aa0ddd84641d325cf68 /tests
parent8c831311be595320750310b24dcd03fdf55b7d6f (diff)
parent647f7fb7f1c3209810a37cb52c834026960e829b (diff)
downloadostree-f79c7a0a0adf4e7a3795ee60eb3d78c5b94c265e.tar.gz
Merge pull request #2783 from cgwalters/test-sudo
tests: Require OSTREE_TEST_SUDO to be set to use `sudo`
Diffstat (limited to 'tests')
-rwxr-xr-xtests/libtest.sh6
-rwxr-xr-xtests/test-basic-bare-split-xattrs.sh2
-rwxr-xr-xtests/test-repo-finder-mount-integration.sh1
3 files changed, 9 insertions, 0 deletions
diff --git a/tests/libtest.sh b/tests/libtest.sh
index af000363..264094b1 100755
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -614,6 +614,12 @@ skip_without_user_xattrs () {
fi
}
+skip_without_sudo () {
+ if test -z "${OSTREE_TEST_SUDO:-}"; then
+ skip "this test needs sudo, skipping without OSTREE_TEST_SUDO being set"
+ fi
+}
+
# Usage: if ! skip_one_without_whiteouts_devices; then ... more tests ...; fi
skip_one_without_whiteouts_devices() {
if ! can_create_whiteout_devices; then
diff --git a/tests/test-basic-bare-split-xattrs.sh b/tests/test-basic-bare-split-xattrs.sh
index bf828eb7..b30e9d6d 100755
--- a/tests/test-basic-bare-split-xattrs.sh
+++ b/tests/test-basic-bare-split-xattrs.sh
@@ -9,7 +9,9 @@ set -euo pipefail
mode="bare-split-xattrs"
OSTREE="${CMD_PREFIX} ostree --repo=${test_tmpdir}/repo"
+skip_without_sudo
SUDO="sudo --non-interactive"
+
PRIVILEGED="false"
if [ $(id -u) -eq 0 ]; then
PRIVILEGED="true"
diff --git a/tests/test-repo-finder-mount-integration.sh b/tests/test-repo-finder-mount-integration.sh
index e7a0f86a..b1a8d422 100755
--- a/tests/test-repo-finder-mount-integration.sh
+++ b/tests/test-repo-finder-mount-integration.sh
@@ -24,6 +24,7 @@ set -euo pipefail
. $(dirname $0)/libtest.sh
+skip_without_sudo
SUDO="sudo --non-interactive"
# Skip the test if a well-known USB stick is not available.