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 (85 lines) | stat: -rw-r--r-- 2,809 bytes parent folder | download | duplicates (3)
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
summary: Check that firstboot assertions are imported and snaps installed also on classic

details: |
    Verify that the snapd.seeded.service unit is able to import assertions from
    the seed directory and install the seed snaps on classic systems. This test
    specifically makes sure that the classic system can install snapd as a snap
    from the seed.

systems: [-ubuntu-core-*]

environment:
    SEED_DIR: /var/lib/snapd/seed

prepare: |
    # In this scenario, the keys from the snapd pkg are used
    if [ "$TRUST_TEST_KEYS" = "false" ] || tests.info is-snapd-from-archive; then
        tests.exec skip-test "This test needs test keys to be trusted" && exit 0        
    fi

    snap pack "$TESTSLIB/snaps/basic18"
    snap download "--$SNAPD_CHANNEL" snapd
    snap download core18

    "$TESTSLIB/reset.sh" --keep-stopped
    mkdir -p "$SEED_DIR/snaps"
    mkdir -p "$SEED_DIR/assertions"
    cat > "$SEED_DIR/seed.yaml" <<EOF
    snaps:
      - name: snapd
        channel: $CORE_CHANNEL
        file: snapd.snap
      - name: core18
        channel: stable
        file: core18.snap
      - name: basic18
        unasserted: true
        file: basic18.snap
    EOF

    echo "Copy the needed assertions to /var/lib/snapd/"
    cp snapd_*.assert "$SEED_DIR/assertions"
    cp core18_*.assert "$SEED_DIR/assertions"
    cp "$TESTSLIB/assertions/developer1.account" "$SEED_DIR/assertions"
    cp "$TESTSLIB/assertions/developer1.account-key" "$SEED_DIR/assertions"
    cp "$TESTSLIB/assertions/developer1-my-classic.model" "$SEED_DIR/assertions"
    cp "$TESTSLIB/assertions/testrootorg-store.account-key" "$SEED_DIR/assertions"

    echo "Copy the needed snaps to $SEED_DIR/snaps"
    cp ./snapd_*.snap "$SEED_DIR/snaps/snapd.snap"
    cp ./core18_*.snap "$SEED_DIR/snaps/core18.snap"
    cp ./basic18_1.0_all.snap "$SEED_DIR/snaps/basic18.snap"

restore: |
    tests.exec is-skipped && exit 0

    rm -rf "$SEED_DIR"
    systemctl start snapd.socket snapd.service

execute: |
    tests.exec is-skipped && exit 0

    echo "Start the daemon with an empty state, this will make it import "
    echo "assertions from the $SEED_DIR/assertions subdirectory and "
    echo "install the seed snaps."
    systemctl start snapd.seeded.service

    echo "Wait for Seed change to be finished"
    for _ in $(seq 120); do
        if snap list 2>/dev/null |grep -q -E "^basic18" ; then
            break
        fi
        sleep 1
    done

    echo "Ensure snapd.seeded.service is active"
    systemctl status snapd.seeded.service

    echo "Verifying the imported assertions"
    if ! snap model --verbose | MATCH "model:\s* my-classic" ; then
        echo "Model assertion was not imported on firstboot"
        exit 1
    fi

    snap list | MATCH "^basic18"
    test -f "$SEED_DIR/snaps/basic18.snap"