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 (41 lines) | stat: -rw-r--r-- 1,363 bytes parent folder | download | duplicates (2)
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
summary: Check that snaps can use stop-timeout

details: |
     A service from a snap may define a stop command as well as a stop
     timeout. When stopping a service, if the stop command takes more
     time than the defined stop timeout, then the stop command will be
     stopped and the service killed. This test verifies that the stop
     timeout works correctly by running a stop command for longer than
     the timeout.

# this test is expected to fail once we run the tests for SELinux
# distros in Enforce mode
# systemd on 14.04 does not really honour TimeoutStopSec
systems: [-ubuntu-14*]

restore: |
    f=test-snapd-service-stop-timeout/staaap.sh
    if [ -e "$f.bak" ]; then
        mv -v "$f.bak" "$f"
    fi

execute: |
    dir=test-snapd-service-stop-timeout
    stamp="/var/snap/test-snapd-service-stop-timeout/current/stamp"
    snap try "$dir"

    # without the sleep, stop-timeout doesn't interfere with stop-command
    test ! -e "$stamp"
    snap stop test-snapd-service-stop-timeout
    test -e "$stamp"

    # add a 'sleep 30'
    sed -i.bak -e 's/^# @@@/sleep 30/' "$dir/staaap.sh"

    snap start test-snapd-service-stop-timeout

    # now it sleeps longer than stop-timeout, the service is killed
    # before it gets to shut down cleanly
    test ! -e "$stamp"
    snap stop test-snapd-service-stop-timeout
    test ! -e "$stamp"