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: Ensure that the snapd-control interface works.
details: |
The snapd-control interface allows a snap to access the locale
configuration.
A snap which defines the snapd-control plug must be shown in the interfaces
list. The plug must not be auto-connected on install and, as usual, must be
able to be reconnected.
A snap declaring a plug on this interface must be able to control the snapd
daemon through the socket, the test snap used has a command to install a
snap (exercising the write capability on the socket) and a command to list
the installed snaps (which checks the read capability). A network plug must
be defined and connected for the snap to be able to talk to the socket, the
snapd-control is not enough by itself.
prepare: |
echo "Given a snap declaring a plug on the snapd-control interface is installed"
snap install --edge test-snapd-control-consumer
execute: |
echo "The interface is connected by default"
snap interfaces -i snapd-control | MATCH ":snapd-control .*test-snapd-control-consumer"
echo "Then the snap command is able to control snapd"
test-snapd-control-consumer.list | not grep -q test-snapd-tools
test-snapd-control-consumer.install test-snapd-tools
retry -n 40 --wait 1 sh -c 'test-snapd-control-consumer.list | MATCH "test-snapd-tools"'
if [ "$(snap debug confinement)" = partial ] ; then
exit 0
fi
echo "When the plug is disconnected"
snap disconnect test-snapd-control-consumer:snapd-control
echo "Then the snap command is not able to control snapd"
if test-snapd-control-consumer.list 2> snapd.error; then
echo "Expected error with plug disconnected"
exit 1
fi
MATCH "Permission denied" < snapd.error
|