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 (31 lines) | stat: -rw-r--r-- 848 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
summary: Check that `snap wait` works

details: |
    The wait command waits until a configuration becomes true.

    This test verifies the `snap wait` command works for seeding
    (seed.loaded) and for an arbitrary configuration.

kill-timeout: 10m

prepare: |
    "$TESTSTOOLS"/snaps-state install-local basic-hooks

execute: |
    echo "Ensure snap wait for seeding works"
    snap wait system seed.loaded

    echo "Ensure snap wait for arbitrary stuff works"
    # set to a false value
    snap set basic-hooks foo=0
    # keep track
    start=$(date +%s)
    # ensure we wait 3s before the false value becomes true
    ( (sleep 3; snap set basic-hooks foo=1)& )
    snap wait basic-hooks foo
    end=$(date +%s)
    # ensure we waited 
    if [ $((end-start)) -lt 2 ]; then
        echo "snap wait returned too early"
        exit 1
    fi