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
|
summary: Ensure that the network-control interface works with TUN/TAP.
details: |
The network-control interface allows a snap to configure networking of
TUN/TAP devices.
A snap declaring a plug on this interface must be able to allocate TUN/TAP
virtual network devices.
https://github.com/torvalds/linux/blob/master/Documentation/networking/tuntap.txt
# This test is randomly failing when running with the full suite.
# It may be a race or a sequence problem with an earlier test.
manual: true
environment:
DEV/tun: tun255
DEV/tap: tap255
prepare: |
echo "Given a snap declaring a plug on the network-control interface is installed"
"$TESTSTOOLS"/snaps-state install-local test-snapd-tuntap
execute: |
#shellcheck source=tests/lib/network.sh
. "$TESTSLIB/network.sh"
echo "The interface is disconnected by default"
snap interfaces -i network-control | MATCH -- '^- +test-snapd-tuntap:network-control$'
echo "When the plug is connected"
snap connect test-snapd-tuntap:network-control
echo "Then the snap command can allocate the $DEV device"
test-snapd-tuntap.tuntap "$DEV" | MATCH "PASS"
if [ "$(snap debug confinement)" = partial ] ; then
exit 0
fi
echo "And cannot allocate the $DEV device"
test-snapd-tuntap.tuntap "$DEV" 2>&1 | MATCH "Permission denied"
|