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 (38 lines) | stat: -rw-r--r-- 1,304 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
summary: Ensure exit code for retryable error works

details: |
    In snapd, the retryable errors are the ones that can be retried later, and 
    snapd uses a different exit code for retryable errors.
    
    This test forces an error installing 2 times the same snap and checks the
    exit code for the the retryable error is 10.

# autopkgtest is sometimes super slow and this test is timing dependent
backends: [-autopkgtest]

execute: |
    echo "Install a snap which takes some time to be installed"
    snap pack test-snapd-sleep-install
    snap install --dangerous test-snapd-sleep-install_*.snap &

    echo "And try to install it again which results in a change conflict error"
    while true; do
        snap changes
        if snap changes | grep "Doing.*Install"; then
            if snap install --dangerous test-snapd-sleep-install_*.snap; then
                echo "snap install should return a change-conflict: test broken"
                exit 1
            else
                errCode=$?
                if [ $errCode != 10 ]; then
                    echo "go unexpected err code $errCode (expecting 10)"
                    exit 1
                fi
            fi
            break
        fi
        sleep 0.1
    done

    # Ensure background processes are finished
    wait