File: task.yaml

package info (click to toggle)
snapd 2.71-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 79,536 kB
  • sloc: ansic: 16,114; sh: 16,105; python: 9,941; makefile: 1,890; exp: 190; awk: 40; xml: 22
file content (37 lines) | stat: -rw-r--r-- 1,169 bytes parent folder | download | duplicates (2)
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