File: task.yaml

package info (click to toggle)
snapd 2.71-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 79,536 kB
  • sloc: ansic: 16,114; sh: 16,105; python: 9,941; makefile: 1,890; exp: 190; awk: 40; xml: 22
file content (44 lines) | stat: -rw-r--r-- 1,494 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
summary: Test connect hook failures

details: |
  Test that failures of connect hook are handled gracefully and do not leave
  snapd or snap in a broken state.

# this test is sensitive to the version of netcat and needs strict confinement
systems: [ubuntu-*]

prepare: |
    snap pack test-connect.v1
    snap pack test-connect.v2

execute: |
    echo "Installing a revision with broken connect hook fails"
    snap install --dangerous test-connect_2_all.snap 2>&1 | MATCH 'failure of connect hook'
    snap list | NOMATCH test-connect

    echo "Installing a revision with no hook"
    snap install --dangerous test-connect_1_all.snap

    echo "Then the snap is able to use netcat"
    test-connect.network-consumer

    echo "Installing the broken revision without triggering connect hook"
    # this works because an older revision was installed and we don't re-connect
    # existing connections.
    snap install --dangerous test-connect_2_all.snap

    snap disconnect test-connect:network

    echo "Then the snap is not able to use netcat with disconnected network"
    test-connect.network-consumer 2>&1 | MATCH "nc: Permission denied"

    echo "Triggering connect hook"
    # this fails because of connect hook
    snap connect test-connect:network 2>&1 | MATCH 'failure of connect hook'

    echo "And the snap is still not able to use netcat"
    test-connect.network-consumer 2>&1 | MATCH "nc: Permission denied"

    echo "Removing the test snap"
    snap remove test-connect