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 (40 lines) | stat: -rw-r--r-- 1,235 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
summary: Check change abort

details: |
    Check a change cannot be aborted when the change is not in progress

environment:
    SNAP_NAME: test-snapd-tools

execute: |
    echo "Abort with invalid id"
    if snap abort 10000000; then
        echo "abort with invalid id should fail"
        exit 1
    fi

    echo "Abort with a valid id - error"
    SNAP_MOUNT_DIR="$(os.paths snap-mount-dir)"
    subdirPath="$SNAP_MOUNT_DIR/$SNAP_NAME/current/foo"
    mkdir -p "$subdirPath"
    if "$TESTSTOOLS"/snaps-state install-local "$SNAP_NAME"; then
        echo "install should fail when the target directory exists"
        exit 1
    fi
    idPattern="\\d+(?= +Error.*?Install \"$SNAP_NAME\" snap)"
    id=$(snap changes | grep -Pzo "$idPattern")
    if snap abort "$id"; then
        echo "abort with valid failed id should fail"
        exit 1
    fi
    rm -rf "$subdirPath"
    rmdir "$SNAP_MOUNT_DIR/$SNAP_NAME/current"

    echo "Abort with a valid id - done"
    "$TESTSTOOLS"/snaps-state install-local "$SNAP_NAME"
    idPattern="\\d+(?= +Done.*?Install \"$SNAP_NAME\" snap)"
    id=$(snap changes | grep -Pzo "$idPattern")
    if snap abort "$id"; then
        echo "abort with valid done id should fail"
        exit 1
    fi