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 (58 lines) | stat: -rw-r--r-- 1,912 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
summary: Ensure that the desktop interface works.

details: |
    The desktop interface allows to access the different resources.

    The test-snapd-desktop snap checks files and dirs are accessible through the
    desktop interface.

systems:
    - -amazon-linux-2-*
    - -ubuntu-14.04-*
    - -ubuntu-core-*

prepare: |
    echo "Given the desktop snap is installed"
    snap try "$TESTSLIB"/snaps/test-snapd-desktop
    tests.session -u test prepare

restore: |
    tests.session -u test restore

execute: |
    dirs="/var/cache/fontconfig /usr/share/icons /usr/share/pixmaps"
    files="/etc/xdg/user-dirs.conf /etc/xdg/user-dirs.defaults"

    echo "The plug is connected by default"
    snap interfaces -i desktop | MATCH ":desktop .*test-snapd-desktop"

    echo "Then the snap is able to desktop files and directories"
    # shellcheck disable=SC2086
    tests.session -u test exec test-snapd-desktop.check-files $files
    # shellcheck disable=SC2086
    tests.session -u test exec test-snapd-desktop.check-dirs $dirs

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

    echo "When the plug is disconnected"
    snap disconnect test-snapd-desktop:desktop

    echo "Then the snap is not able to access the desktop files"
    for file in $files; do
        if tests.session -u test exec test-snapd-desktop.check-files "$file" 2> call.error; then
            echo "Expected permission error calling desktop with disconnected plug"
            exit 1
        fi
        MATCH "Permission denied" < call.error
    done

    echo "Then the snap is not able to access the desktop dirs"
    for dir in $dirs; do
        if tests.session -u test exec test-snapd-desktop.check-dirs "$dir" 2> call.error; then
            echo "Expected permission error calling desktop with disconnected plug"
            exit 1
        fi
        MATCH "Permission denied" < call.error
    done