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 (34 lines) | stat: -rw-r--r-- 1,187 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
summary: smoke test for the user-state tool

details: |
    Check the user-state test tools works properly. Verify it can
    remove/list users and groups.

execute: |
    # Check help
    "$TESTSTOOLS"/user-state | MATCH "usage: user-state remove-with-group <user>"
    "$TESTSTOOLS"/user-state -h | MATCH "usage: user-state remove-with-group <user>"
    "$TESTSTOOLS"/user-state --help | MATCH "usage: user-state remove-with-group <user>"

    # Check list users
    "$TESTSTOOLS"/user-state list-users | MATCH test

    # Check list groups
    "$TESTSTOOLS"/user-state list-groups | MATCH test

    # Check remove user and group
    if [ -f /var/lib/extrausers/passwd ]; then
        if os.query is-core-ge 24; then
            useradd --extrausers mytest001
        else
            adduser --extrausers --quiet --disabled-password --gecos '' mytest001
        fi
    else
        groupadd mytest001
        useradd mytest001 -g mytest001
    fi
    "$TESTSTOOLS"/user-state list-users | MATCH mytest001
    "$TESTSTOOLS"/user-state remove-with-group mytest001

    "$TESTSTOOLS"/user-state list-users | NOMATCH mytest001
    "$TESTSTOOLS"/user-state list-groups | NOMATCH mytest001