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 (48 lines) | stat: -rw-r--r-- 1,377 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
summary: Check that removal of essential snaps does not work

details: |
    This test validates snapd and base snaps cannot be
    removed. Also checks that a core base snap cannot be 
    removed when other installed snap is based on that one.

# UC16 does not seed the snapd snap (yet)
systems: [-ubuntu-core-16-*]

execute: |
    echo "Ensure snapd cannot be removed"
    if snap remove --purge snapd; then
        echo "The snapd snap should not be removable"
        exit 1
    fi

    if os.query is-core18; then
        base=core18
    elif os.query is-core20; then
        base=core20
    elif os.query is-core22; then
        base=core22
    elif os.query is-core24; then
        base=core24
    fi
    echo "Ensure $base cannot be removed"
    if snap remove --purge "$base"; then
        echo "The $base snap should not removable"
        exit 1
    fi

    echo "Install a snap that requires core as the base"
    snap install test-snapd-sh
    snap list | MATCH '^core '
    if snap remove --purge core; then
        echo "core should not be removable because test-snapd-tools needs it"
        exit 1
    fi

    echo "But core can be removed again once nothing on the system needs it"
    snap remove --purge test-snapd-sh
    snap remove --purge core

    if snap list | MATCH '^core '; then
        echo "core was not removed correctly"
        exit 1
    fi