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
|
summary: Ensure that service and apparmor profiles work after a reboot
details: |
The test checks that after a system reboot the snaps are still there,
the snapd service is running and the apparmor profiles are still loaded.
# Start early as it takes a long time.
priority: 100
prepare: |
"$TESTSTOOLS"/snaps-state install-local test-snapd-tools
"$TESTSTOOLS"/snaps-state install-local test-snapd-service
execute: |
echo "Ensure snaps are (still) there."
snap list | MATCH test-snapd-tools
snap list | MATCH test-snapd-service
echo "Ensure the service is (still) running."
retries=120
while ! systemctl is-active snap.test-snapd-service.test-snapd-service.service; do
if [ "$retries" -eq 0 ]; then
echo "Service did not activate."
exit 1
fi
retries=$(( retries - 1 ))
sleep 1
done
echo "Ensure apparmor profiles are (still) loaded."
for app in success fail echo head env block cat; do
MATCH "snap.test-snapd-tools.$app \\(enforce\\)" < /sys/kernel/security/apparmor/profiles
done
if [ "$SPREAD_REBOOT" = "0" ]; then
REBOOT
fi
|