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 (44 lines) | stat: -rw-r--r-- 1,730 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
summary: Check that 'current' symlink is created with 'snap run'

details: |
  Running a snap creates the symbolic link that points to the per-revision data
  of a given user. The test manipulates the symbolic link to show that running a
  snap command creates or re-creates the symbolic link as necessary.

systems: [-ubuntu-core-*]

prepare: |
    "$TESTSTOOLS"/snaps-state install-local test-snapd-sh

execute: |
    echo "Test that 'current' symlink is created in user data dir"
    SNAP_MOUNT_DIR="$(os.paths snap-mount-dir)"
    CURRENT=$(readlink "$SNAP_MOUNT_DIR/test-snapd-sh/current")
    if [ -z "$CURRENT" ]; then
      echo "Could not determine current version of $SNAP"
      exit 1
    fi

    "$SNAP_MOUNT_DIR/bin/test-snapd-sh.sh" -c 'echo -n'
    UDATA_CURRENT=$(readlink "$HOME/snap/test-snapd-sh/current")
    if [ "$CURRENT" != "$UDATA_CURRENT" ]; then
      echo "Invalid 'current' symlink in user-data directory, expected $CURRENT, got $UDATA_CURRENT"
      exit 1
    fi

    echo "Test that 'current' symlink is recreated"
    rm -rf "$HOME/snap/test-snapd-sh/current"
    "$SNAP_MOUNT_DIR/bin/test-snapd-sh.sh" -c 'echo -n'
    if [ ! -L "$HOME/snap/test-snapd-sh/current" ]; then
      echo "The 'current' symlink not present in user-data directory"
      exit 1
    fi

    echo "Test that 'current' symlink is updated if incorrect"
    ln -fs "$HOME/snap/test-snapd-sh/wrong" "$HOME/snap/test-snapd-sh/current"
    "$SNAP_MOUNT_DIR/bin/test-snapd-sh.sh" -c 'echo -n'
    UDATA_CURRENT=$(readlink "$HOME/snap/test-snapd-sh/current")
    if [ "$CURRENT" != "$UDATA_CURRENT" ]; then
      echo "Invalid 'current' symlink in user-data directory, expected $CURRENT, got $UDATA_CURRENT"
      exit 1
    fi