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 (69 lines) | stat: -rw-r--r-- 2,565 bytes parent folder | download
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
summary: Ensure that the network-manager interface works

details: |
    The network-manager interface gives privileged access to configure and
    observe networking.

    The test uses a snap which plugs the network manager interface. Then it is
    validated that the snap auto-connects and can create a new connection.
    Connection against network devices cannot be validated on a virtual machine
    due to network-manager being configured not to managed them.

# run only against the amd64 VM, we cannot run this on arm/arm64
# boards because the (wifi) network is already managed by netplan
# there and when n-m gets installed/removed it will hang when
# trying to deconfigure the wifi network which is already owned.
systems:
    - ubuntu-core-16-*
    - ubuntu-core-18-*
    - ubuntu-core-2*

prepare: |
    echo "Given a network-manager snap is installed"
    if os.query is-core16; then
        snap install --channel=latest network-manager
    elif os.query is-core18; then
        snap install --channel=1.10 network-manager
    elif os.query is-core20; then
        snap install --channel=20 network-manager
    elif os.query is-core22; then
        snap install --channel=22 network-manager
    else
        snap install --channel=24 network-manager
    fi

    rm -f /etc/netplan/00-default-nm-renderer.yaml

execute: |
    # using wait_for_service is not enough, systemd considers the service
    # active even when it is not (yet) listening to dbus
    for _ in $(seq 300); do
        if network-manager.nmcli general; then
            break
        fi
        sleep 1
    done

    echo "The interface is connected by default"
    snap connections network-manager | MATCH "network-manager:nmcli *network-manager:service"

    echo "And allows to add a new connection"
    conn_name=nmtest
    network-manager.nmcli con add type ethernet con-name $conn_name ifname eth0 | MATCH "successfully added"
    network-manager.nmcli c | MATCH "^$conn_name .+ethernet +"

    echo "And allows to remove a connection"
    network-manager.nmcli connection delete id $conn_name | MATCH "successfully deleted"

    echo "And allows to show devices information"
    network-manager.nmcli d show

    echo "When the plug is disconnected"
    snap disconnect network-manager:nmcli

    echo "Then the consumer is not able to access the provided methods"
    if network-manager.nmcli general 2> call.error; then
        echo "Expected permission error calling nmcli method with disconnected plug"
        exit 1
    fi
    MATCH "Permission denied" < call.error