Skip to content

Commit

Permalink
New test: lxd-user (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomponline authored Dec 6, 2024
2 parents 0a72186 + 8f97682 commit 05d312f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
- devlxd-vm
- docker
- efi-vars-editor-vm
- lxd-user
- interception
- network-bridge-firewall
- network-ovn
Expand Down Expand Up @@ -129,6 +130,8 @@ jobs:
track: "4.0/candidate"
- test: efi-vars-editor-vm
track: "4.0/candidate"
- test: lxd-user
track: "4.0/candidate"
- test: network-bridge-firewall
track: "4.0/candidate"
os: 20.04
Expand Down Expand Up @@ -166,6 +169,8 @@ jobs:
track: "4.0/edge"
- test: efi-vars-editor-vm
track: "4.0/edge"
- test: lxd-user
track: "4.0/edge"
- test: network-bridge-firewall
track: "4.0/edge"
os: 20.04
Expand Down
3 changes: 0 additions & 3 deletions bin/helpers
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,6 @@ install_lxd() (
mount --bind "${LXD_AGENT_SIDELOAD_PATH}" /snap/lxd/current/bin/lxd-agent
fi

# Enable debug logging if not done already
[ "$(snap get lxd daemon.debug 2>/dev/null)" = "true" ] || snap set lxd daemon.debug=true

if [ "$start_daemon" = "true" ]; then
lxd waitready --timeout=300
fi
Expand Down
24 changes: 24 additions & 0 deletions tests/lxd-user
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 05d312f

Please sign in to comment.