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 34 35 36 37 38 39 40 41 42 43 44 45 46
|
summary: Check that is possible to handle user accounts
details: |
This test makes sure that a snap using the account-control interface
can handle the user accounts properly.
systems: [ubuntu-core-16-64, ubuntu-core-18-64, ubuntu-core-20-64, ubuntu-core-22-64]
environment:
TSNAP: account-control-consumer
prepare: |
#shellcheck source=tests/lib/core-config.sh
. "$TESTSLIB"/core-config.sh
echo "Given a snap declaring a plug on account-control is installed"
SUFFIX="$(get_test_snap_suffix)"
"$TESTSTOOLS"/snaps-state install-local "${TSNAP}${SUFFIX}"
echo "And the account-control plug is connected"
snap connect "${TSNAP}${SUFFIX}":account-control
restore: |
#shellcheck source=tests/lib/core-config.sh
. "$TESTSLIB"/core-config.sh
SUFFIX="$(get_test_snap_suffix)"
echo "Ensure alice is gone from the system"
for f in /var/lib/extrausers/*; do
sed -i '/^alice:/d' "$f"
done
snap remove --purge "${TSNAP}${SUFFIX}"
execute: |
#shellcheck source=tests/lib/core-config.sh
. "$TESTSLIB"/core-config.sh
SUFFIX="$(get_test_snap_suffix)"
# It is added a user using a snap with the same base than UC
# because pam is configured to load a binary module and when
# the snap is a different base, UC fails to load the module
snap run "${TSNAP}${SUFFIX}".useradd --extrausers alice
echo alice:password | snap run "${TSNAP}${SUFFIX}".chpasswd
# User deletion is unsupported yet on Core: https://bugs.launchpad.net/ubuntu/+source/shadow/+bug/1659534
# snap run "${TSNAP}${SUFFIX}".userdel --extrausers alice
|