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 (63 lines) | stat: -rw-r--r-- 2,140 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
summary: Test refreshing snapd and running new units

details: |
    Check that snapd can be installed and reverted many times in a row resulting in a
    working snapd. Also ensure snapd is working after a reboot.

# UC16 still uses the core snap rather than the snapd snap, so disable this test
# for UC16
systems: [-ubuntu-core-16-*]

environment:
    # uploading large snap triggers OOM
    SNAPD_NO_MEMORY_LIMIT: 1

restore: |
    # Remove all inactive revisions of snapd.
    current=$(readlink /snap/snapd/current)
    for revno_path in /snap/snapd/*; do
        revno=$(basename "$revno_path")
        if [ "$revno" == current ] || [ "$revno" == "$current" ]; then
            continue
        fi
        snap remove snapd --revision="$revno"
    done

execute: |
    echo "Testing refresh/revert of snapd"
    current=$(readlink /snap/snapd/current)
    SNAPD_SNAP=$(ls /var/lib/snapd/snaps/snapd_"$current".snap)
    for _ in $(seq 10); do

        echo "Installing a new snapd snap"
        snap install --dangerous "$SNAPD_SNAP"
        echo "Still leaves 'snap list' working"
        if snap list | grep "snapd.*$current "; then
            echo "snap install of new snapd did not update to new snapd"
            exit 1
        fi
        running="$(readlink -f /proc/"$(pidof snapd)"/exe)"
        if echo "$running" | grep "/snap/snapd/$current/usr/lib/"; then
            echo "The current running snapd is not $running"
            exit 1
        fi

        echo "And reverting snapd"
        snap revert snapd
        echo "Also gives us a working snapd"
        snap list | MATCH "snapd.*$current "
        echo "And we see the original snapd running"
        running="$(readlink -f /proc/"$(pidof snapd)"/exe)"
        echo "$running" | MATCH "/snap/snapd/$current/usr/lib/"
    done
    snap changes | MATCH 'Install "snapd"'
    snap changes | MATCH 'Revert "snapd" snap'

    # ensure snapd is working after a reboot
    if [ "$SPREAD_REBOOT" = 0 ]; then
        REBOOT
    fi

    snap list | MATCH "snapd.*$current "
    snap install test-snapd-sh-core18
    test-snapd-sh-core18.sh -c 'echo hello' | MATCH hello