ctdb-scripts: Tests for monitoring of CTDB_NATGW_PUBLIC_IFACE
authorMartin Schwenke <martin@meltin.net>
Fri, 18 Dec 2015 05:23:04 +0000 (16:23 +1100)
committerAmitay Isaacs <amitay@samba.org>
Mon, 25 Jan 2016 06:18:25 +0000 (07:18 +0100)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/eventscripts/11.natgw.051.sh [new file with mode: 0755]
ctdb/tests/eventscripts/11.natgw.052.sh [new file with mode: 0755]
ctdb/tests/eventscripts/11.natgw.053.sh [new file with mode: 0755]
ctdb/tests/eventscripts/11.natgw.054.sh [new file with mode: 0755]

diff --git a/ctdb/tests/eventscripts/11.natgw.051.sh b/ctdb/tests/eventscripts/11.natgw.051.sh
new file mode 100755 (executable)
index 0000000..8a385b6
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "Monitor CTDB_NATGW_PUBLIC_IFACE, slave, up"
+
+setup_ctdb
+setup_ctdb_natgw <<EOF
+192.168.1.21
+192.168.1.22 master
+192.168.1.23
+192.168.1.24
+EOF
+
+ok_null
+simple_test_event "monitor"
diff --git a/ctdb/tests/eventscripts/11.natgw.052.sh b/ctdb/tests/eventscripts/11.natgw.052.sh
new file mode 100755 (executable)
index 0000000..091b6f6
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "Monitor CTDB_NATGW_PUBLIC_IFACE, slave, down"
+
+setup_ctdb
+setup_ctdb_natgw <<EOF
+192.168.1.21
+192.168.1.22 master
+192.168.1.23
+192.168.1.24
+EOF
+
+ethtool_interfaces_down "$CTDB_NATGW_PUBLIC_IFACE"
+
+required_result 1 <<EOF
+ERROR: No link on the public network interface ${CTDB_NATGW_PUBLIC_IFACE}
+EOF
+simple_test_event "monitor"
diff --git a/ctdb/tests/eventscripts/11.natgw.053.sh b/ctdb/tests/eventscripts/11.natgw.053.sh
new file mode 100755 (executable)
index 0000000..00b72ed
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "Monitor CTDB_NATGW_PUBLIC_IFACE, master, up"
+
+setup_ctdb
+setup_ctdb_natgw <<EOF
+192.168.1.21 master
+192.168.1.22
+192.168.1.23
+192.168.1.24
+EOF
+
+ctdb setnatgwstate on
+
+ok_null
+simple_test_event "monitor"
diff --git a/ctdb/tests/eventscripts/11.natgw.054.sh b/ctdb/tests/eventscripts/11.natgw.054.sh
new file mode 100755 (executable)
index 0000000..25a1c92
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "Monitor CTDB_NATGW_PUBLIC_IFACE, master, down"
+
+setup_ctdb
+setup_ctdb_natgw <<EOF
+192.168.1.21 master
+192.168.1.22
+192.168.1.23
+192.168.1.24
+EOF
+
+ctdb setnatgwstate on
+
+ethtool_interfaces_down "$CTDB_NATGW_PUBLIC_IFACE"
+
+required_result 1 <<EOF
+ERROR: No link on the public network interface ${CTDB_NATGW_PUBLIC_IFACE}
+EOF
+simple_test_event "monitor"