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 (47 lines) | stat: -rw-r--r-- 1,693 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
summary: Checks for snap login

details: |
    The "snap login" command allows authenticating to snapd as a known user in
    the snap store (with an email, password and an optional 2FA token). Once
    logged in, the snap command sends the stored authentication cookie to each
    snapd request. Since the login command requires the use of "sudo", snapd
    also remembers that an user had super-user permissions and allows performing
    certain operations, such as installing or removing snaps, that are normally
    reserved to the root user, to an unprivileged user.

    The test attempts to authenticate, both unsuccessfully and successfully.
    Using the "snap managed" command, the test checks that the authentication
    was correctly recorded for future requests and lastly that the "snap logout"
    command works as expected.

# ppc64el disabled because of https://bugs.launchpad.net/snappy/+bug/1655594
systems: [-ubuntu-core-*, -ubuntu-*-ppc64el]

restore: |
    snap logout || true

execute: |
    echo "Checking missing email error"
    expect -d -f missing_email_error.exp

    echo "Checking wrong password error"
    expect -d -f unsuccessful_login.exp

    output=$(snap managed)
    if [ "$output" != "false" ]; then
        echo "Unexpected output from 'snap managed': $output"
        exit 1
    fi

    if [ -n "$SPREAD_STORE_USER" ] && [ -n "$SPREAD_STORE_PASSWORD" ]; then
        echo "Checking successful login"
        expect -d -f "$TESTSLIB"/successful_login.exp

        output=$(snap managed)
        if [ "$output" != "true" ]; then
            echo "Unexpected output from 'snap managed': $output"
            exit 1
        fi

        snap logout
    fi