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,624 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 refresh-modes works

details: |
    Snapd services can be configured to control whether should be restarted
    during a snap refresh through the refresh-mode option. The available options
    to configure are: restart , endure, (do not restart) or ignore-running 
    (does not refresh running services to facilitate the refresh app awareness feature)
    
    This test refreshes the test-snapd-service snap and checks the service
    test-snapd-endure-service which is configured with 'refresh-mode: endure'
    is not restarted during the refresh (keeps the same pid).

# takes >1.5min to run
backends: [-autopkgtest]

kill-timeout: 10m

debug: |
    grep -n '' ./*.pid || true
    systemctl status snap.test-snapd-service.test-snapd-endure-service || true

execute: |
    echo "When the service snap is installed"
    "$TESTSTOOLS"/snaps-state install-local test-snapd-service

    echo "We can see it running"
    systemctl status snap.test-snapd-service.test-snapd-endure-service|MATCH "running"
    systemctl show -p MainPID snap.test-snapd-service.test-snapd-endure-service > old-main.pid

    echo "When it is re-installed"
    "$TESTSTOOLS"/snaps-state install-local test-snapd-service

    echo "We can still see it running with the same PID"
    systemctl show -p MainPID snap.test-snapd-service.test-snapd-endure-service > new-main.pid

    test "$(cat new-main.pid)" = "$(cat old-main.pid)"

    echo "Once the snap is removed, the service is stopped"
    snap remove --purge test-snapd-service
    # shellcheck disable=SC2119
    "$TESTSTOOLS"/journal-state get-log | MATCH "stop endure"