From 362ee8305073efaa3083c2a07d635789b474b6ae Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 4 Dec 2024 17:57:23 -0500 Subject: [PATCH] tests/lxd-user: test lxd-user daemon Signed-off-by: Simon Deziel --- tests/lxd-user | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 tests/lxd-user 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