mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
* First part of the improvements done for pkg management The idea of this change is to use the tests.pkg tools instead of the pkgdb.sh helper when possible * Squashed 'tests/lib/external/snapd-testing-tools/' changes from 1c8efb77e1..c82afb2dee c82afb2dee Support --no-install-recommends parameter when installing dependencies with tests.pkgs b84eea92e2 spread-shellcheck: fix quotes in environment variables (#41) ab1e51c29f New comparison in os-query for core systems (#40) e5ae22a5d4 systemd units can be overwritten 63540b845a Fix error messages in remote pull and push 75e8a426a5 make sure the unit is removed in tests.systemd test 9089ff5c02 Update tests to use the new tests.systemd stop-unit 44ecd5e56a Move tests.systemd stop-units to stop-unit 01a2a83b4b Update tests.systemd to have stop units as systemd.sh 162e93bd35 update tests.systemd CLI options to be the same than retry command 14aa43a405 new feature to re-run failed spread tests (#39) 604cb782db Fix shellcheck in systemd tool bfc71082c8 Update the tests.systemd to allow parameters waiting for service status 8a2d0a99df Adding quiet tool and removing set +-x from tests.pkgs d90935d2a4 A comment explaining about the default values for wait-for 3232c5dba7 Add support for ubuntu 23.04 a7164fba07 remove fedora 35 support, add fedora 37 support 89b9eb5301 Update systems supported 92bb6a0664 Include snap-sufix in the snaps.name tool git-subtree-dir: tests/lib/external/snapd-testing-tools git-subtree-split: c82afb2dee93a6f2ee047608f0e27d3c4af10a88 * defer tests.pkgs remove inotify-tools * Squashed 'tests/lib/external/snapd-testing-tools/' changes from c82afb2dee..5e7b63883d 5e7b63883d Fixes for osquery and tests pkgs (#43) 4c9145e2ac support reboot waiting for auto-refresh 45768f5188 show changes in unknown status after refresh 8013c30c2a Remove support for ubuntu 22.10 b32b80bf54 Fix remote.rait-for test in bionic 5675c625e9 Enable fedora 38 55f4471957 Support for new oss f2e88b357c New tool used to query spread json reports cacd35ede0 utils/spread-shellcheck: explain disabled warnings (#42) git-subtree-dir: tests/lib/external/snapd-testing-tools git-subtree-split: 5e7b63883df49cdc72e2fc1fe0a23dd79224ab27 * Squashed 'tests/lib/external/snapd-testing-tools/' changes from 5e7b63883d..2a5c4414a3 2a5c4414a3 fix shellcheck errors git-subtree-dir: tests/lib/external/snapd-testing-tools git-subtree-split: 2a5c4414a3db1ec8f8e37ee78d7d3c5b5b7a082b
104 lines
4.0 KiB
YAML
104 lines
4.0 KiB
YAML
summary: Ensure that the openvswitch interface works.
|
|
|
|
details: |
|
|
The openvswitch interface allows to task to the openvswitch socket (rw mode).
|
|
|
|
A snap which defines a openvswitch plug must be shown in the interfaces list.
|
|
The plug must not be autoconnected on install and, as usual, must be able to be
|
|
reconnected.
|
|
|
|
A snap declaring a plug on this interface must be able to do all the operations that
|
|
are carried through the socket, in this test we exercise bridge and port creation,
|
|
list and deletion.
|
|
|
|
# Openvswitch getting stuck during installation sporadically on ubuntu-14.04-64
|
|
# Openvswitch service fails to start on debian-sid
|
|
# Openvswitch service not available on the following systems
|
|
systems: [-ubuntu-core-*, -opensuse-*, -amazon-*, -arch-linux-*, -centos-*, -debian-sid-*, -ubuntu-14.04-64]
|
|
|
|
prepare: |
|
|
echo "Given openvswitch is installed"
|
|
tests.pkgs install openvswitch-switch
|
|
|
|
# Ensure the openvswitch service is started which isn't the case by
|
|
# default on all distributions
|
|
if systemctl status openvswitch-switch.service | MATCH "Loaded:.*loaded"; then
|
|
systemctl enable --now openvswitch-switch.service
|
|
elif systemctl status openvswitch.service | MATCH "Loaded:.*loaded"; then
|
|
systemctl enable --now openvswitch.service
|
|
fi
|
|
|
|
echo "And a snap declaring a plug on the openvswitch interface is installed"
|
|
snap install --edge test-snapd-openvswitch-consumer
|
|
|
|
echo "And a tap interface is defined"
|
|
ip tuntap add tap1 mode tap
|
|
|
|
restore: |
|
|
ovs-vsctl del-port br0 tap1 || true
|
|
ovs-vsctl del-br br0 || true
|
|
|
|
ip link delete tap1 || true
|
|
|
|
execute: |
|
|
echo "The interface is disconnected by default"
|
|
snap interfaces -i openvswitch | MATCH -- '^- +test-snapd-openvswitch-consumer:openvswitch'
|
|
|
|
echo "When the plug is connected"
|
|
snap connect test-snapd-openvswitch-consumer:openvswitch
|
|
|
|
echo "Then the snap is able to create a bridge"
|
|
test-snapd-openvswitch-consumer.ovs-vsctl add-br br0
|
|
ovs-vsctl list-br | MATCH br0
|
|
|
|
echo "And the snap is able to create a port"
|
|
test-snapd-openvswitch-consumer.ovs-vsctl add-port br0 tap1
|
|
ovs-vsctl list-ports br0 | MATCH tap1
|
|
|
|
echo "And the snap is able to delete a port"
|
|
test-snapd-openvswitch-consumer.ovs-vsctl del-port br0 tap1
|
|
ovs-vsctl list-ports br0 | NOMATCH tap1
|
|
|
|
echo "And the snap is able to delete a bridge"
|
|
test-snapd-openvswitch-consumer.ovs-vsctl del-br br0
|
|
ovs-vsctl list-br | NOMATCH br0
|
|
|
|
if [ "$(snap debug confinement)" = partial ] ; then
|
|
exit 0
|
|
fi
|
|
|
|
echo "When the plug is disconnected"
|
|
snap disconnect test-snapd-openvswitch-consumer:openvswitch
|
|
|
|
echo "Then the snap is not able to create a bridge"
|
|
if test-snapd-openvswitch-consumer.ovs-vsctl add-br br0 2> bridge-creation.error; then
|
|
echo "Expected permission error accessing openvswitch socket with disconnected plug"
|
|
exit 1
|
|
fi
|
|
MATCH 'database connection failed \(Permission denied\)' < bridge-creation.error
|
|
|
|
ovs-vsctl add-br br0
|
|
|
|
echo "And the snap is not able to create a port"
|
|
if test-snapd-openvswitch-consumer.ovs-vsctl add-port br0 tap1 2> port-creation.error; then
|
|
echo "Expected permission error accessing openvswitch socket with disconnected plug"
|
|
exit 1
|
|
fi
|
|
MATCH 'database connection failed \(Permission denied\)' < port-creation.error
|
|
|
|
ovs-vsctl add-port br0 tap1
|
|
|
|
echo "And the snap is not able to delete a port"
|
|
if test-snapd-openvswitch-consumer.ovs-vsctl del-port br0 tap1 2> port-deletion.error; then
|
|
echo "Expected permission error accessing openvswitch socket with disconnected plug"
|
|
exit 1
|
|
fi
|
|
MATCH 'database connection failed \(Permission denied\)' < port-deletion.error
|
|
|
|
echo "And the snap is not able to delete a bridge"
|
|
if test-snapd-openvswitch-consumer.ovs-vsctl del-br br0 2> br-creation.error; then
|
|
echo "Expected permission error accessing openvswitch socket with disconnected plug"
|
|
exit 1
|
|
fi
|
|
MATCH 'database connection failed \(Permission denied\)' < br-creation.error
|