Skip to content

Commit

Permalink
tests: Add incus-user test
Browse files Browse the repository at this point in the history
Closes #142

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
  • Loading branch information
stgraber committed Oct 11, 2023
1 parent 1a213b3 commit 8dbbabe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ if [ "${1:-"all"}" != "cluster" ]; then
run_test test_metrics "Metrics"
run_test test_storage_volume_recover "Recover storage volumes"
run_test test_syslog_socket "Syslog socket"
run_test test_incus_user "incus-user"
fi

# shellcheck disable=SC2034
Expand Down
19 changes: 19 additions & 0 deletions test/suites/incus_user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
test_incus_user() {
ensure_import_testimage
ensure_has_localhost_remote "${INCUS_ADDR}"

incus-user --group nogroup &
USER_PID="$!"
while :; do
[ -S "${INCUS_DIR}/unix.socket.user" ] && break
done

USER_TEMPDIR="${TEST_DIR}/user"
mkdir "${USER_TEMPDIR}"
chown nobody:nogroup "${USER_TEMPDIR}"

cmd=$(unset -f incus; command -v incus)
sudo -u nobody -Es -- env INCUS_CONF="${USER_TEMPDIR}" "${cmd}" project list

kill -9 "${USER_PID}"
}

0 comments on commit 8dbbabe

Please sign in to comment.