File: task.yaml

package info (click to toggle)
snapd 2.71-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 79,536 kB
  • sloc: ansic: 16,114; sh: 16,105; python: 9,941; makefile: 1,890; exp: 190; awk: 40; xml: 22
file content (43 lines) | stat: -rw-r--r-- 1,871 bytes parent folder | download | duplicates (2)
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
summary: Ensure that the content sharing interface with defaults work.

details: |
    The content interface allows two or more snaps to access the same location
    under different names by creating a bind mount visible to the snap
    application process.

    This test checks that two snaps can take advantage of the implicit value of
    the content attribute, which is the name of the plug or slot itself, to
    successfully establish an interface connection and share data.

prepare: |
    echo "Given a snap declaring a content sharing slot is installed"
    snap install --edge test-snapd-content-slot-no-content-attr

    echo "And a snap declaring a content sharing plug is installed"
    snap install --edge test-snapd-content-plug-no-content-attr

execute: |
    echo "Then the snap is listed as connected"
    snap interfaces -i content | MATCH "test-snapd-content-slot-no-content-attr:shared-content +test-snapd-content-plug-no-content-attr"

    echo "And fstab files are created"
    [ "$(find /var/lib/snapd/mount -type f -name '*.fstab' | wc -l)" -gt 0 ]

    echo "And we can use the shared content"
    test-snapd-content-plug-no-content-attr.content-plug | grep "Some shared content"

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

    echo "When the plug is disconnected"
    snap disconnect test-snapd-content-plug-no-content-attr:shared-content test-snapd-content-slot-no-content-attr:shared-content

    echo "Then the fstab files are removed"
    [ "$(find /var/lib/snapd/mount -type f -name '*.fstab' | wc -l)" -eq 0 ]

    echo "When the plug is reconnected"
    snap connect test-snapd-content-plug-no-content-attr:shared-content test-snapd-content-slot-no-content-attr:shared-content

    echo "Then the fstab files are recreated"
    [ "$(find /var/lib/snapd/mount -type f -name '*.fstab' | wc -l)" -gt 0 ]