File: task.yaml

package info (click to toggle)
snapd 2.49-1%2Bdeb11u2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 36,432 kB
  • sloc: ansic: 12,125; sh: 8,453; python: 2,163; makefile: 1,284; exp: 173; xml: 22
file content (80 lines) | stat: -rw-r--r-- 3,172 bytes parent folder | download
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
summary: Check basic core20 system functionality

systems: [ubuntu-core-20-*]

execute: |
    echo "Check that the system snaps are there"
    snap list core20
    snap list snapd
    if snap list core; then
        echo "The old core snap is installed but should not"
        exit 1
    fi

    echo "Ensure that the system is fully seeded"
    snap changes | MATCH "Done.*Initialize system state"

    echo "Check that a simple shell snap"
    snap install test-snapd-sh-core20
    test-snapd-sh-core20.sh -c 'echo hello' | MATCH hello

    if python3 -m json.tool < /var/lib/snapd/system-key | grep '"build-id": ""'; then
        echo "The build-id of snapd must not be empty."
        exit 1
    fi

    echo "Ensure passwd/group is available for snaps"
    test-snapd-sh-core20.sh -c 'cat /var/lib/extrausers/passwd' | MATCH test

    #shellcheck source=tests/lib/names.sh
    . "$TESTSLIB"/names.sh

    if [[ "$SPREAD_SYSTEM" = ubuntu-core-20-64 ]]; then
        echo "Ensure extracted kernel.efi exists"
        test -e /boot/grub/"$kernel_name"*/kernel.efi

        echo "Ensure kernel.efi is a symlink"
        test -L /boot/grub/kernel.efi

        echo "Ensure we are using managed boot assets"
        MATCH '# Snapd-Boot-Config-Edition: [0-9]+' < /boot/grub/grub.cfg
        MATCH '# Snapd-Boot-Config-Edition: [0-9]+' < /run/mnt/ubuntu-seed/EFI/ubuntu/grub.cfg
    else
        echo "Ensure extracted {kernel,initrd}.img exists"
        test -e /run/mnt/ubuntu-seed/systems/*/kernel/kernel.img
        test -e /run/mnt/ubuntu-seed/systems/*/kernel/initrd.img
    fi

    echo "Ensure that model was written to ubuntu-boot"
    test -e /run/mnt/ubuntu-boot/device/model

    # ensure that our the-tool (and thus our snap-bootstrap ran)
    # for external backend the initramfs is not rebuilt
    echo "Check that we booted with the rebuilt initramfs in the kernel snap"
    if [ "$SPREAD_BACKEND" != "external" ]; then
        test -e /writable/system-data/the-tool-ran
    fi

    # ensure we handled cloud-init, either we have:
    # a) cloud init is disabled
    # b) there was a cloud.cfg.d override (e.g. MAAS), then we must have more
    #    files in writable than in the core20 snap. The core20 content and the
    #    extra config will be merged
    test -e /writable/system-data/etc/cloud/cloud-init.disabled || [ "$(find /writable/system-data/etc/cloud/cloud.cfg.d/ | wc -l)" -gt "$(find /snap/core20/current/etc/cloud/cloud.cfg.d/ | wc -l)" ]

    # ensure that we have no symlinks from /var/lib/snapd/snaps to
    # /var/lib/snapd/seed
    for sn in /var/lib/snapd/snaps/*.snap ; do
        if [[ -L $sn ]]; then
            echo "snap $sn is a symlink but should not be"
            exit 1
        fi
    done

    # ensure the "snap recovery" command works
    MODEL="$(snap model --verbose | grep '^model' | awk '{ print $2 }')"
    BRAND_ID="$(snap model --verbose | grep '^brand-id:' | awk '{print $2}')"
    if [ "$(snap known account "username=$BRAND_ID" | grep '^validation:' | awk '{print $2}')" != "unproven" ]; then
        BRAND_ID="$BRAND_ID\*"
    fi
    snap recovery --unicode=never | MATCH "[0-9]+ +$BRAND_ID +$MODEL +current"