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,678 bytes parent folder | download | duplicates (4)
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 the undo on refresh keeps the previous snap intact
details: |
    When a snap is refreshed and the refresh fails, the undo code had
    a bug that removed the security confinement (LP: #1637981)

# trusty has unreliable journalctl output for unknown reasonsg
systems: [-ubuntu-14.04-*]

environment:
    SNAP_NAME: test-snapd-service
    SNAP_NAME_GOOD: ${SNAP_NAME}-v1-good
    SNAP_NAME_BAD: ${SNAP_NAME}-v2-bad
    SNAP_FILE_GOOD: ${SNAP_NAME}_1.0_all.snap
    SNAP_FILE_BAD: ${SNAP_NAME}_2.0_all.snap

prepare: |
    echo "Given a good (v1) and a bad (v2) snap"
    snap pack "$TESTSLIB/snaps/$SNAP_NAME_GOOD"
    snap pack "$TESTSLIB/snaps/$SNAP_NAME_BAD"

debug: |
    "$TESTSTOOLS"/journal-state get-log -u snap.test-snapd-service.service.service

execute: |
    wait_for_service_status() {
        retries=0
        while ! systemctl status snap.test-snapd-service.service.service|grep "$1"; do
            # retry
            retries=$((retries+1))
            if [ $retries -gt 30 ]; then
                echo 'expected "service v1" output did not appear in systemctl status snap.test-snapd-service.service.service'
                exit 1
            fi
            sleep 1
        done
    }
    echo "When we install v1"
    snap install --dangerous "${SNAP_FILE_GOOD}"
    echo "The v1 service started correctly"
    wait_for_service_status "service v1"

    echo "When we refresh to v2"
    if snap install --dangerous "${SNAP_FILE_BAD}"; then
       echo "The ${SNAP_FILE_BAD} snap should not install cleanly, test broken"
       exit 1
    fi
    echo "Then v2 is rolled back and v1 is started again"
    wait_for_service_status "service v1"