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 (48 lines) | stat: -rw-r--r-- 1,642 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
summary: Check that the core.watchdog settings work

details: |
    Check the snap service watchdog can be updated through
    the watchdog.runtime-timeout and watchdog.shutdown-timeout
    configs. Verify that when the configs are unset, the default
    values are used.

environment:
    WATCHDOG_FILE: /etc/systemd/system.conf.d/10-snapd-watchdog.conf

prepare: |
    if [ -f "$WATCHDOG_FILE" ]; then
        echo "Watchdog file already present, testbed not clean"
        exit 1
    fi

restore: |
    rm -f "$WATCHDOG_FILE"

execute: |
    systemd_ver="$(systemctl --version | awk '/systemd [0-9]+/ { print $2 }' | cut -f1 -d"~")"
    REBOOT_WATCHDOG_PROP=RebootWatchdogUSec
    if [ "${systemd_ver}" -lt 243 ]; then
        REBOOT_WATCHDOG_PROP=ShutdownWatchdogUSec
    fi

    echo "Ensure snap service watchdog works"
    snap set core watchdog.runtime-timeout=1m
    MATCH RuntimeWatchdogSec=60 < "$WATCHDOG_FILE"
    systemctl show -p RuntimeWatchdogUSec|MATCH RuntimeWatchdogUSec=1m

    snap set core watchdog.shutdown-timeout=1h
    MATCH ShutdownWatchdogSec=3600 <  "$WATCHDOG_FILE"
    systemctl show -p "$REBOOT_WATCHDOG_PROP"|MATCH "${REBOOT_WATCHDOG_PROP}=1h"

    echo "Unsetting removes the file"
    snap set core watchdog.runtime-timeout=
    snap set core watchdog.shutdown-timeout=0s
    if [ -f "$WATCHDOG_FILE" ]; then
        echo "Empty watchdog config should remove config file but did not"
        exit 1
    fi

    # check we are back to the default values
    systemctl show -p RuntimeWatchdogUSec|MATCH RuntimeWatchdogUSec=0
    systemctl show -p "$REBOOT_WATCHDOG_PROP"|MATCH "${REBOOT_WATCHDOG_PROP}=10m"