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-- 1,319 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: Ensure that post-refresh hook has permissions for its connected slot.

# Note: it is critical for this test to use a slot that requires
# peer=<plug security tag> expression label for dbus, and not simply
# label=unconfined on a permanent slot snippet.
details: |
    Ensure that post-refresh hook has permissions to query upower-observe slot
    and enumerate upower devices.

# amazon-linux-2023: upower package is not available
systems: [-amazon-linux-2023-*]

prepare: |
    if os.query is-core; then
        snap install test-snapd-upower --edge
    fi
    "$TESTSTOOLS"/snaps-state install-local test-snap

execute: |
    if ! os.query is-core; then
      # trigger upowerd to have the service started as AppArmor would deny to
      # start it in response to a dbus call from inside a snap (because the
      # service is not started yet and AppArmor doesn't know what confinement
      # the service would be started under, so it denies the startup).
      dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.EnumerateDevices > /dev/null 2>&1
    fi

    # simulate refresh; the post-refresh hook does the dbus query
    snap install --dangerous test-snap/test-snap_1.0_all.snap

    MATCH "array \[" < /var/snap/test-snap/common/enumerate.txt