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 (62 lines) | stat: -rw-r--r-- 2,694 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
summary: D-Bus session services support activation via systemd user session

details: |
    Verify that snaps that consume the D-Bus session bus can be activated by the
    systemd-provided D-Bus session. This is tested by starting a systemd user
    session, installing a snap that provides an activatable D-Bus service, and
    verifying that the service is activated when a method call is made.

prepare: |
    if ! tests.session has-session-systemd-and-dbus; then
        exit 0
    fi
    # Ensure that snapd.session-agent.socket is enabled.  This may not
    # be the case on distributions where presets have been used to
    # disable it.
    if [ ! -L /usr/lib/systemd/user/sockets.target.wants/snapd.session-agent.socket ] &&
            ! systemctl --user --global is-enabled snapd.session-agent.socket; then
        systemctl --user --global enable snapd.session-agent.socket
        touch agent-was-enabled
    fi

    snap set system experimental.user-daemons=true
    tests.session -u test prepare

restore: |
    if ! tests.session has-session-systemd-and-dbus; then
        exit 0
    fi
    tests.session -u test restore
    if [ -f agent-was-enabled ]; then
        systemctl --user --global disable snapd.session-agent.socket
    fi
    snap unset system experimental.user-daemons

execute: |
    if ! tests.session has-session-systemd-and-dbus; then
        echo "System does not have a systemd managed D-Bus session bus"
        exit 0
    fi

    echo "Install a snap containing an activatable D-Bus session service"
    snap install --edge test-snapd-dbus-service

    echo "A service activation file has been created"
    test -f /var/lib/snapd/dbus-1/services/io.snapcraft.SnapDbusService.service

    echo "The service is not initially running"
    not tests.session -u test exec systemctl --user is-active snap.test-snapd-dbus-service.session.service

    echo "Making a method call wakes the service"
    "$TESTSTOOLS"/snaps-state install-local test-snapd-dbus-service-client
    snap connect test-snapd-dbus-service-client:dbus-session-plug \
                 test-snapd-dbus-service:dbus-session-slot
    tests.session -u test exec test-snapd-dbus-service-client.session | MATCH hello

    echo "The corresponding D-Bus service is now running"
    tests.session -u test exec systemctl --user is-active snap.test-snapd-dbus-service.session.service

    echo "Removing the snap stops the service and removes the service activation file"
    snap remove test-snapd-dbus-service
    not tests.session -u test exec systemctl --user is-active snap.test-snapd-dbus-service.session.service
    test ! -f /var/lib/snapd/dbus-1/services/io.snapcraft.SnapDbusService.service