diff --git a/tests/lxd-user b/tests/lxd-user new file mode 100755 index 00000000..ab5bfc3f --- /dev/null +++ b/tests/lxd-user @@ -0,0 +1,24 @@ +#!/bin/bash +set -eux + +lxc_user() { + sudo -Hu testuser LXD_DIR=/var/snap/lxd/common/lxd-user lxc "${@}" +} + +# Install lxd +install_lxd + +# Create testuser account +useradd -m testuser -G lxd --uid 5000 + +# Access lxd-user +lxc_user info +lxc_user project list +lxc_user project list -f csv | grep '^user-5000.*,"User restricted project for ""testuser"" (5000)",' + +# Cleanup +lxc project delete user-5000 +userdel -r testuser 2>/dev/null || true + +# shellcheck disable=SC2034 +FAIL=0