File: task.yaml

package info (click to toggle)
snapd 2.72-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,412 kB
  • sloc: sh: 16,506; ansic: 16,211; python: 11,213; makefile: 1,919; exp: 190; awk: 58; xml: 22
file content (96 lines) | stat: -rw-r--r-- 3,974 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
summary: Check snap listings

details: |
    Check the output of command `snap list` is the expected based on the current systems

prepare: |
    "$TESTSTOOLS"/snaps-state install-local test-snapd-sh

    snap set system experimental.parallel-instances=true
    "$TESTSTOOLS"/snaps-state install-local-as test-snapd-sh test-snapd-sh_foo

restore: |
    snap set system experimental.parallel-instances=null

execute: |
    echo "List prints core snap version"
    # all core versions will start with something like "16-2.61.4", so "[0-9]{2}-[0-9.]+"
    # with core in security maintenance it has additional date like "16-2.61.4-20240607", so optional "(-[0-9]+)?"
    # in edge it has additional git identifier like "16-2.63+g5348.e45449bd5", so optional "(\\+(git|g)[0-9]+\\.[0-9a-f]+)?"
    # In the past the word "git" was included in such version so it is retained for compatibility.

    # Expressions for version and revision
    NUMERIC_VERSION="[0-9]+(\.[0-9]+)*"
    CORE_GIT_VERSION="[0-9]{2}-[0-9.]+(-[0-9]+)?(\\+(git|g)[0-9]+\\.[0-9a-f]+)?" # core on  edge, beta, candidate, stable & sideload
    CORE_STABLE_VERSION="[0-9]{2}-[0-9.]+(-[0-9]+)?"                             # core on stable for SRU/PPA
    SNAPD_GIT_VERSION="+g?[0-9.]+(\\+(git|g)?[0-9]+\\.[0-9a-z]+)?(-dirty)?"      # snapd on edge, beta, candidate, stable, sideload & dirty
    SIDELOAD_REV="x[0-9]+"
    NUMBER_REV="[0-9]+"

    # Default values
    NAME=core
    VERSION=$CORE_GIT_VERSION
    REV=$NUMBER_REV
    PUBLISHER="canonical\\*\\*"
    TRACKING=-
    NOTES=core

    #shellcheck disable=SC2166
    if [[ "$SPREAD_BACKEND" =~ google ]] || [[ "$SPREAD_BACKEND" =~ openstack ]] || [ "$SPREAD_BACKEND" == "qemu" ] && os.query is-core16; then
        echo "With customized images the core snap is sideloaded"
        REV=$SIDELOAD_REV
        PUBLISHER=-

    elif [[ "$SPREAD_BACKEND" =~ google ]] || [[ "$SPREAD_BACKEND" =~ openstack ]] || [ "$SPREAD_BACKEND" == "qemu" ] && os.query is-core-ge 18; then
        echo "With customized images the snapd snap is sideloaded"
        NAME=snapd
        VERSION=$SNAPD_GIT_VERSION
        REV=$SIDELOAD_REV
        PUBLISHER=-
        NOTES=snapd

    elif [ "$SRU_VALIDATION" = "1" ] || [ -n "$PPA_VALIDATION_NAME" ]; then
        echo "When either sru or ppa validation is done the core snap is installed from the store"
        VERSION=$CORE_STABLE_VERSION
        TRACKING="(latest/)?stable"

    elif [ "$SPREAD_BACKEND" = "external" ] || [ "$SPREAD_BACKEND" = "testflinger" ]; then
        if os.query is-core16; then
            echo "On the external/testflinger device the core snap tested could be in any track"
            TRACKING="(latest/)?(edge|beta|candidate|stable)"
        else
            echo "On the external/testflinger device the snapd snap tested could be in any track"
            NAME=snapd
            VERSION=$SNAPD_GIT_VERSION
            TRACKING="(latest/)?(edge|beta|candidate|stable)"
            NOTES=snapd
        fi

    else
        TRACKING="(latest/)?$CORE_CHANNEL"
    fi

    expected="^$NAME +$VERSION +$REV +$TRACKING +$PUBLISHER +$NOTES.*$"
    snap list --unicode=never | MATCH "$expected"

    echo "List prints installed snaps and versions"
    snap list | MATCH "^test-snapd-sh +$NUMERIC_VERSION +$SIDELOAD_REV +- +- +- *$"
    snap list | MATCH "^test-snapd-sh_foo +$NUMERIC_VERSION +$SIDELOAD_REV +- +- +- *$"

    echo "Install test-snapd-sh again"
    "$TESTSTOOLS"/snaps-state install-local test-snapd-sh

    echo "And run snap list --all"
    output=$(snap list --all | grep 'test-snapd-sh ')
    if [ "$(grep -c test-snapd-sh <<< "$output")" != "2" ]; then
        echo "Expected two test-snapd-sh in the output, got:"
        echo "$output"
        exit 1
    fi
    if [ "$(grep -c disabled <<< "$output")" != "1" ]; then
        echo "Expected one disabled line in in the output, got:"
        echo "$output"
        exit 1
    fi

    snap list --all | MATCH 'test-snapd-sh_foo '