mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
* Adding more details to tests - part 13 * Add more details * adding more tests * Update tests/main/debs/task.yaml Co-authored-by: Miguel Pires <miguelpires94@gmail.com> * Update tests/main/debug-sandbox/task.yaml Co-authored-by: Miguel Pires <miguelpires94@gmail.com> * Update tests/main/econnreset/task.yaml Co-authored-by: Miguel Pires <miguelpires94@gmail.com> * Update tests/main/enable-disable/task.yaml Co-authored-by: Miguel Pires <miguelpires94@gmail.com> * Update tests/main/health/task.yaml Co-authored-by: Miguel Pires <miguelpires94@gmail.com> * Update tests/main/snap-validate-enforce/task.yaml Co-authored-by: Miguel Pires <miguelpires94@gmail.com> * Update tests/main/snap-validate-with-store/task.yaml Co-authored-by: Miguel Pires <miguelpires94@gmail.com> * Update tests/main/enable-disable/task.yaml Co-authored-by: Miguel Pires <miguelpires94@gmail.com> * Update tests/main/debug-paths/task.yaml Co-authored-by: Miguel Pires <miguelpires94@gmail.com> * Update tests/main/default-tracks/task.yaml Co-authored-by: Miguel Pires <miguelpires94@gmail.com> * Update tests/main/enable-disable/task.yaml Co-authored-by: Miguel Pires <miguelpires94@gmail.com> --------- Co-authored-by: Miguel Pires <miguelpires94@gmail.com>
61 lines
2.3 KiB
YAML
61 lines
2.3 KiB
YAML
summary: Check that enable/disable works
|
|
|
|
details: |
|
|
Snapd allows enabling and disabling snaps through the `snap enable` and
|
|
`snap disable` commands. When a snap is disabled, the binaries and services
|
|
of the snap will no longer be available, but all the data is still available
|
|
and the snap can easily be enabled again.
|
|
|
|
This test verifies that when a snap is disabled, it is listed as disabled and
|
|
the command and the security profiles are no longer there. Then it checks
|
|
that the snap runs normally after it is enabled.
|
|
|
|
It also checks that the important snaps (core, gadget and kernel) can't
|
|
be disabled.
|
|
|
|
prepare: |
|
|
echo "Install test-snapd-sh and ensure it runs"
|
|
"$TESTSTOOLS"/snaps-state install-local test-snapd-sh
|
|
test-snapd-sh.sh -c 'echo Hello' | MATCH Hello
|
|
|
|
execute: |
|
|
echo "Disable test-snapd-sh and ensure it is listed as disabled"
|
|
snap disable test-snapd-sh | MATCH disabled
|
|
|
|
echo "Ensure the test-snapd-sh command is no longer there"
|
|
SNAP_MOUNT_DIR="$(os.paths snap-mount-dir)"
|
|
if ls "$SNAP_MOUNT_DIR"/bin/test-snapd-sh*; then
|
|
echo "test-snapd-sh binaries are not disabled"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$(snap debug confinement)" = strict ]; then
|
|
echo "Ensure the test-snapd-sh security profiles are no longer there"
|
|
if ls /var/lib/snapd/apparmor/profiles/snap.test-snapd-sh*; then
|
|
echo "test-snapd-sh securiry profiles are not disabled"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo "Enable test-snapd-sh again and ensure it is no longer listed as disabled"
|
|
snap enable test-snapd-sh | MATCH enabled
|
|
|
|
if [ "$(snap debug confinement)" = strict ]; then
|
|
echo "Ensure the test-snapd-sh security profiles are present"
|
|
if ! ls /var/lib/snapd/apparmor/profiles/snap.test-snapd-sh*; then
|
|
echo "test-snapd-sh securiry profiles are not present"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo "Ensure test-snapd-sh runs normally after it was enabled"
|
|
test-snapd-sh.sh -c 'echo Hello' |MATCH Hello
|
|
|
|
echo "Ensure the important snaps can not be disabled"
|
|
for sn in core $(snaps.name kernel) $(snaps.name gadget); do
|
|
if snap disable "$sn"; then
|
|
echo "It should not be possible to disable $sn"
|
|
exit 1
|
|
fi
|
|
done
|