Skip to content

Commit

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

Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Oct 12, 2023
1 parent 1a213b3 commit 2844e72
Show file tree
Hide file tree
Showing 2 changed files with 21 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
20 changes: 20 additions & 0 deletions test/suites/incus_user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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
sleep 0.5
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 2844e72

Please sign in to comment.