tests: Add some 10.interfaces VLAN tests
authorMartin Schwenke <martin@meltin.net>
Wed, 8 Jul 2015 12:22:09 +0000 (22:22 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Thu, 16 Jul 2015 04:35:23 +0000 (14:35 +1000)
One without a bond, one with a bond.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(Imported from commit 8ed0cacaf4aa9fc63b8c8d610a6164c5d01e473a)

tests/eventscripts/10.interface.monitor.017.sh [new file with mode: 0755]
tests/eventscripts/10.interface.monitor.018.sh [new file with mode: 0755]

diff --git a/tests/eventscripts/10.interface.monitor.017.sh b/tests/eventscripts/10.interface.monitor.017.sh
new file mode 100755 (executable)
index 0000000..6e30040
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "1 VLAN, link down"
+
+setup_ctdb
+
+iface=$(ctdb_get_1_interface)
+
+ethtool_interfaces_down "$iface"
+
+# This just exercises the VLAN checking code, which will allow us to
+# determine that real0 is not a bond.
+realiface="real0"
+ip link add link "$realiface" name "$iface" type vlan id 11
+ip link set "${iface}@${realiface}" up
+
+required_result 1 "ERROR: No link on the public network interface ${iface}"
+simple_test
diff --git a/tests/eventscripts/10.interface.monitor.018.sh b/tests/eventscripts/10.interface.monitor.018.sh
new file mode 100755 (executable)
index 0000000..aac23b8
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "VLAN on bond, active slaves, link down"
+
+setup_ctdb
+
+iface=$(ctdb_get_1_interface)
+
+bond="bond0"
+
+setup_bond "$bond" "" "down"
+
+ip link add link "$bond" name "$iface" type vlan id 11
+ip link set "${iface}@${bond}" up
+
+required_result 1 "ERROR: public network interface ${bond} is down"
+
+simple_test