1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
summary: ensure snap fails to install if one of user or group doesn't exist
details: |
When a snap package declares that it needs the snap_daemon user to exist,
and the host system has only the group but not the user itself, then such
snap cannot be installed.
# List of expected snap install failures due to libseccomp/golang-seccomp being
# too old. Since the illegal name check happens after verifying system support,
# we can ignore these. Ignore ubuntu-core since groupdel doesn't support
# --extrausers
systems: [-amazon-linux-2-*, -ubuntu-14.04-*, -ubuntu-core-*]
prepare: |
groupadd --system snap_daemon
restore: |
# Make sure the snap is removed if the test failed and the snap was
# installed
snap remove --purge test-snapd-daemon-user || true
# snapd will create this for us, but we'll remove it for consistency in
# test runs
groupdel snap_daemon || true
not getent group snap_daemon
execute: |
echo "When the snap_daemon group exists but not the user"
getent passwd snap_daemon && exit 1
getent group snap_daemon || exit 1
echo "Then the snap cannot be installed"
snap install --edge test-snapd-daemon-user 2>&1 | tr '\n' ' ' | tr -s ' ' | MATCH 'cannot add user/group "snap_daemon": group exists and user does not'
|