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
|
summary: Ensure that the network-setup-control interface works.
details: |
The network setup control interface allows to access the different netplan
configuration files.
systems: [-ubuntu-core-*]
prepare: |
"$TESTSTOOLS"/snaps-state install-local test-snapd-sh
restore: |
rm -f /etc/network/test001 /etc/netplan/test001
execute: |
dirs="/etc/netplan /etc/network"
echo "The interface is disconnected by default"
snap interfaces -i network-setup-control | MATCH -- '^- +test-snapd-sh:network-setup-control'
echo "When the interface is connected"
snap connect test-snapd-sh:network-setup-control
echo "Then the snap is able to write in the network and netplan directories"
for dir in $dirs; do
if [ -d "$dir" ]; then
test-snapd-sh.with-network-setup-control-plug -c "touch $dir/test001"
fi
done
if [ "$(snap debug confinement)" = partial ] ; then
exit 0
fi
echo "When the plug is disconnected"
snap disconnect test-snapd-sh:network-setup-control
echo "Then the snap is not able to access the networking configuration dirs"
for dir in $dirs; do
if [ -d "$dir" ]; then
if test-snapd-sh.with-network-setup-control-plug -c "touch $dir/test002" 2>call.error; then
echo "Expected permission error calling desktop with disconnected plug"
exit 1
fi
MATCH "Permission denied" < call.error
fi
done
echo "Then the interface can be connected again"
snap connect test-snapd-sh:network-setup-control
|