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 (46 lines) | stat: -rw-r--r-- 1,622 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
summary: Check that is possible to handle user accounts

details: |
    This test makes sure that a snap using the account-control interface
    can handle the user accounts properly.

systems: [ubuntu-core-16-64, ubuntu-core-18-64, ubuntu-core-20-64, ubuntu-core-22-64]

environment:
    TSNAP: account-control-consumer

prepare: |
    #shellcheck source=tests/lib/core-config.sh
    . "$TESTSLIB"/core-config.sh

    echo "Given a snap declaring a plug on account-control is installed"
    SUFFIX="$(get_test_snap_suffix)"
    "$TESTSTOOLS"/snaps-state install-local "${TSNAP}${SUFFIX}"

    echo "And the account-control plug is connected"
    snap connect "${TSNAP}${SUFFIX}":account-control

restore: |
    #shellcheck source=tests/lib/core-config.sh
    . "$TESTSLIB"/core-config.sh
    SUFFIX="$(get_test_snap_suffix)"

    echo "Ensure alice is gone from the system"
    for f in /var/lib/extrausers/*; do
        sed -i '/^alice:/d' "$f"
    done
    snap remove --purge "${TSNAP}${SUFFIX}"

execute: |
    #shellcheck source=tests/lib/core-config.sh
    . "$TESTSLIB"/core-config.sh
    SUFFIX="$(get_test_snap_suffix)"

    # It is added a user using a snap with the same base than UC
    # because pam is configured to load a binary module and when
    # the snap is a different base, UC fails to load the module
    snap run "${TSNAP}${SUFFIX}".useradd --extrausers alice
    echo alice:password | snap run "${TSNAP}${SUFFIX}".chpasswd

    # User deletion is unsupported yet on Core: https://bugs.launchpad.net/ubuntu/+source/shadow/+bug/1659534
    # snap run "${TSNAP}${SUFFIX}".userdel --extrausers alice