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 47 48 49 50 51 52 53
|
summary: Check that install/remove works
details: |
Snapd installs packages by mounting them in a structure under /snap or
/var/lib/snapd/snap directories, depending on distribution policy. Ensure
that a trivial test snap can be installed and removed, and that after
removal no leftovers remain in the mounting area.
execute: |
tests.exec is-skipped && exit 0
"$TESTSTOOLS"/snaps-state install-local test-snapd-sh-core24
SNAP_MOUNT_DIR="$(os.paths snap-mount-dir)"
test -d "$SNAP_MOUNT_DIR/test-snapd-sh-core24"
echo "Ensure remove works"
snap remove test-snapd-sh-core24
test ! -d "$SNAP_MOUNT_DIR/test-snapd-sh-core24"
if snap list test-snapd-sh-core24; then
echo "test-snapd-sh-core24 should be removed but it is not"
snap list
exit 1
fi
echo "Ensure removal of last active revision works"
"$TESTSTOOLS"/snaps-state install-local test-snapd-sh-core24
snap list test-snapd-sh-core24
snap remove --revision=x1 test-snapd-sh-core24
not snap list test-snapd-sh-core24
echo "Ensure purge of last active revision works"
"$TESTSTOOLS"/snaps-state install-local test-snapd-sh-core24
snap list test-snapd-sh-core24
snap remove --revision=x1 --purge test-snapd-sh-core24
not snap list test-snapd-sh-core24
echo "Ensure removal by revision of inactive revision works"
"$TESTSTOOLS"/snaps-state install-local test-snapd-sh-core24 # x1
"$TESTSTOOLS"/snaps-state install-local test-snapd-sh-core24 # x2
"$TESTSTOOLS"/snaps-state install-local test-snapd-sh-core24 # x3
# x3 is currently active revision
echo "Ensure removal of inactive revision"
snap remove --revision=x1 --purge test-snapd-sh-core24
snap list --all test-snapd-sh-core24 | NOMATCH x1
snap list --all test-snapd-sh-core24 | MATCH x2
snap list --all test-snapd-sh-core24 | MATCH x3
echo "Ensure currently active revision cannot be removed, but has to be reverted"
not snap remove --revision=x3 --purge test-snapd-sh-core24 2> stderr.out
MATCH 'cannot remove active revision x3' < stderr.out
|