File: task.yaml

package info (click to toggle)
snapd 2.74.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 81,428 kB
  • sloc: sh: 16,966; ansic: 16,788; python: 11,332; makefile: 1,897; exp: 190; awk: 58; xml: 22
file content (74 lines) | stat: -rw-r--r-- 2,787 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
summary: core revert test

details: |
    Older versions of snapd used to change the way seccomp profiles are handled, which could cause
    problems when future snapd was reverted to old snapd, causing old profiles to
    fail to parse and load. This was addressed with the introduction of a system
    key and eventually with the switch to pre-compiled seccomp profiles. This
    test uses a virtual machine to ensure that the core snap can be safely
    reverted in case this is required for another reason.

systems: [ubuntu-18.04-64]

kill-timeout: 30m

environment:
    IMAGE_FILE: $SNAPD_WORK_DIR/images/ubuntu-core-new.img

skip:
    - reason: This test needs to start from beta/candidate/stable channel
      if: |
        [ "$NESTED_BUILD_SNAPD_FROM_CURRENT" = "true" ] || [ "$NESTED_CORE_CHANNEL" = "$NESTED_CORE_REFRESH_CHANNEL" ]

debug: |
    systemctl stop nested-vm || true
    if [ -f "$IMAGE_FILE" ]; then
        loops=$(kpartx -avs "$IMAGE_FILE" | cut -d' ' -f 3)

        part=$(echo "$loops" | tail -1)

        tmp=$(mktemp -d)
        mount "/dev/mapper/$part" "$tmp"

        grep --text "hsearch_r failed for.* No such process" "$tmp/system-data/var/log/syslog"

        umount "$tmp"
        rm -rf "$tmp"
        kpartx -ds "$IMAGE_FILE"
    fi

execute: |
    echo "Refresh the core snap to $NESTED_CORE_REFRESH_CHANNEL channel"
    remote.exec "snap info core" | MATCH "tracking: +latest/${NESTED_CORE_CHANNEL}"
    remote.exec "sudo snap refresh --${NESTED_CORE_REFRESH_CHANNEL} core" || true

    if ! tests.nested wait-for ssh; then
        echo "ssh connection not established, exiting..."
        exit 1
    fi

    echo "Wait until the refresh is completed"
    remote.exec "retry --wait 1 -n 180 --env NESTED_CORE_REFRESH_CHANNEL=$NESTED_CORE_REFRESH_CHANNEL sh -c 'snap changes | MATCH "Done.*Refresh \"core\" snap from \""${NESTED_CORE_REFRESH_CHANNEL}"\" channel"'"
    remote.exec "snap info core" | MATCH "tracking: +latest/${NESTED_CORE_REFRESH_CHANNEL}"

    echo "Precondition check, no refresh should be done here but the command shouldn't fail"
    remote.exec "sudo snap refresh"

    echo "Revert the core snap"
    remote.exec "sudo snap revert core" || true

    if ! tests.nested wait-for ssh; then
        echo "ssh connection not established, exiting..."
        exit 1
    fi

    echo "Wait until the revert is completed"
    remote.exec "retry --wait 1 -n 180 sh -c 'snap changes" | MATCH "Done.*Revert \"core\" snap'"

    echo "Check the revert was done properly"
    remote.exec "snap info core" | MATCH "tracking: +latest/${NESTED_CORE_REFRESH_CHANNEL}"
    remote.exec "ifconfig" | MATCH eth0


    remote.exec "sudo snap refresh"
    remote.exec "sudo cat /var/log/syslog" | NOMATCH "hsearch_r failed for.* No such process"