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 (37 lines) | stat: -rw-r--r-- 1,437 bytes parent folder | download | duplicates (4)
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
summary: Ensures that introspection of login1 of the shutdown interface works.

details: |
    A snap declaring the shutdown plug is defined, its command just calls
    the Introspect method on org.freedesktop.login1.

#debian: no confinement (AppArmor, Seccomp) available on these systems
#ubuntu-core: unity7 implicit classic slot needed (used to access dbus-send) not available on core
systems: [-debian-*, -ubuntu-core-*]

prepare: |
    echo "Given a snap declaring a plug on the shutdown interface is installed"
    "$TESTSTOOLS"/snaps-state install-local shutdown-introspection-consumer

execute: |
    echo "The interface is disconnected by default"
    snap interfaces -i shutdown | MATCH -- '- +shutdown-introspection-consumer:shutdown'

    echo "When the plug is connected"
    snap connect shutdown-introspection-consumer:shutdown

    echo "Then the snap is able to get introspect org.freedesktop.login1"
    expected="<interface name=\"org.freedesktop.login1.Manager\">"
    su -l -c "shutdown-introspection-consumer" test | MATCH "$expected"

    if [ "$(snap debug confinement)" = partial ]; then
        exit
    fi

    echo "When the plug is disconnected"
    snap disconnect shutdown-introspection-consumer:shutdown

    echo "Then the snap is not able to get system information"
    if su -l -c "shutdown-introspection-consumer" test; then
        echo "Expected error with plug disconnected"
        exit 1
    fi