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 (69 lines) | stat: -rw-r--r-- 2,417 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
summary: Check that more than one snap is refreshed.

details: |
    We use only the fake store for this test because we currently
    have only one controlled snap in the remote stores, when we will
    have more we can update the test to use them

# ubuntu-14.04: systemd-run not supported
systems: [-ubuntu-core-*, -ubuntu-14.04*]

environment:
    BLOB_DIR: $(pwd)/fake-store-blobdir

prepare: |
    if [ "$TRUST_TEST_KEYS" = "false" ]; then
        echo "This test needs test keys to be trusted"
        exit
    fi

    # needed for test-snapd-tools_instance
    snap set system experimental.parallel-instances=true

    echo "Given snaps installed"
    for snap in test-snapd-tools test-snapd-tools_instance test-snapd-python-webserver; do
        snap install $snap
    done

    echo "And the daemon is configured to point to the fake store"
    "$TESTSTOOLS"/store-state setup-fake-store "$BLOB_DIR"

restore: |
    if [ "$TRUST_TEST_KEYS" = "false" ]; then
        echo "This test needs test keys to be trusted"
        exit
    fi
    "$TESTSTOOLS"/store-state teardown-fake-store "$BLOB_DIR"
    rm -rf "$BLOB_DIR"

    snap set system experimental.parallel-instances=null

execute: |
    if [ "$TRUST_TEST_KEYS" = "false" ]; then
        echo "This test needs test keys to be trusted"
        exit
    fi

    echo "Precondition check for the fake store"
    snap refresh --list 2>&1 | MATCH "All snaps up to date."
    snap refresh 2>&1 | MATCH "All snaps up to date."

    echo "When the store is configured to make them refreshable"
    "$TESTSTOOLS"/store-state init-fake-refreshes "$BLOB_DIR" test-snapd-tools
    retry -n 4 --wait 0.5 test -e "$BLOB_DIR"/test-snapd-tools*fake1*.snap
    "$TESTSTOOLS"/store-state init-fake-refreshes  "$BLOB_DIR" test-snapd-python-webserver
    retry -n 4 --wait 0.5 test -e "$BLOB_DIR"/test-snapd-python-webserver*fake1*.snap

    # make sure that "snap refresh --list" correctly shows the new revisions
    snap refresh --list > refresh-list.out 2>&1
    MATCH 'test-snapd-python-webserver' < refresh-list.out
    MATCH 'test-snapd-tools' < refresh-list.out
    MATCH 'test-snapd-tools_instance' < refresh-list.out

    echo "And a refresh is performed"
    snap refresh

    echo "Then the new versions are installed"
    for snap in test-snapd-tools test-snapd-tools_instance test-snapd-python-webserver; do
        snap list | MATCH "$snap .*fake1"
    done