summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2012-07-18 17:05:03 +1000
committerMartin Schwenke <martin@meltin.net>2012-09-28 17:05:34 +1000
commit28345d83c0dd1ce89b156a9953e552e3411c8cfd (patch)
treea768f36fe87edf7ed22c7537498b24e4c24e996a
parent3ccaba7842e22029ee6541b4f9e35c80f756c056 (diff)
downloadsamba-28345d83c0dd1ce89b156a9953e552e3411c8cfd.tar.gz
samba-28345d83c0dd1ce89b156a9953e552e3411c8cfd.tar.xz
samba-28345d83c0dd1ce89b156a9953e552e3411c8cfd.zip
tests/tool: New tests for natgwlist, getcapabilities, lvs, lvsmaster
Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 6bd4feff7039138d435428eeded51975c44e567c)
-rwxr-xr-xctdb/tests/tool/stubby.getcapabilities.001.sh30
-rwxr-xr-xctdb/tests/tool/stubby.getcapabilities.002.sh30
-rwxr-xr-xctdb/tests/tool/stubby.getcapabilities.003.sh27
-rwxr-xr-xctdb/tests/tool/stubby.lvs.001.sh27
-rwxr-xr-xctdb/tests/tool/stubby.lvsmaster.001.sh28
-rwxr-xr-xctdb/tests/tool/stubby.lvsmaster.002.sh28
-rwxr-xr-xctdb/tests/tool/stubby.natgwlist.001.sh37
-rwxr-xr-xctdb/tests/tool/stubby.natgwlist.002.sh37
-rwxr-xr-xctdb/tests/tool/stubby.natgwlist.003.sh35
-rwxr-xr-xctdb/tests/tool/stubby.natgwlist.004.sh37
-rwxr-xr-xctdb/tests/tool/stubby.natgwlist.005.sh37
11 files changed, 353 insertions, 0 deletions
diff --git a/ctdb/tests/tool/stubby.getcapabilities.001.sh b/ctdb/tests/tool/stubby.getcapabilities.001.sh
new file mode 100755
index 0000000000..df4a659008
--- /dev/null
+++ b/ctdb/tests/tool/stubby.getcapabilities.001.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "3 nodes, all ok"
+
+required_result 0 <<EOF
+RECMASTER: YES
+LMASTER: YES
+LVS: NO
+NATGW: YES
+EOF
+
+simple_test <<EOF
+NODEMAP
+0 192.168.20.41 0x0 CURRENT RECMASTER
+1 192.168.20.42 0x0
+2 192.168.20.43 0x0
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+EOF
diff --git a/ctdb/tests/tool/stubby.getcapabilities.002.sh b/ctdb/tests/tool/stubby.getcapabilities.002.sh
new file mode 100755
index 0000000000..9a37c4a93e
--- /dev/null
+++ b/ctdb/tests/tool/stubby.getcapabilities.002.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "3 nodes, 1 disconnected"
+
+required_result 0 <<EOF
+RECMASTER: YES
+LMASTER: YES
+LVS: NO
+NATGW: YES
+EOF
+
+simple_test <<EOF
+NODEMAP
+0 192.168.20.41 0x0 CURRENT RECMASTER
+1 192.168.20.42 0x1
+2 192.168.20.43 0x0
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+EOF
diff --git a/ctdb/tests/tool/stubby.getcapabilities.003.sh b/ctdb/tests/tool/stubby.getcapabilities.003.sh
new file mode 100755
index 0000000000..33b1b74a20
--- /dev/null
+++ b/ctdb/tests/tool/stubby.getcapabilities.003.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "3 nodes, current disconnected"
+
+required_result 10 <<EOF
+DATE TIME [PID]: Unable to get nodemap from local node
+EOF
+
+simple_test <<EOF
+NODEMAP
+0 192.168.20.41 0x1 CURRENT RECMASTER
+1 192.168.20.42 0x0
+2 192.168.20.43 0x0
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+EOF
diff --git a/ctdb/tests/tool/stubby.lvs.001.sh b/ctdb/tests/tool/stubby.lvs.001.sh
new file mode 100755
index 0000000000..29e9ce0cdc
--- /dev/null
+++ b/ctdb/tests/tool/stubby.lvs.001.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "3 nodes, all ok"
+
+# This isn't very useful, since the stub for capabilities does set LVS :-)
+required_result 0 <<EOF
+EOF
+
+simple_test <<EOF
+NODEMAP
+0 192.168.20.41 0x0 CURRENT RECMASTER
+1 192.168.20.42 0x0
+2 192.168.20.43 0x0
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+EOF
diff --git a/ctdb/tests/tool/stubby.lvsmaster.001.sh b/ctdb/tests/tool/stubby.lvsmaster.001.sh
new file mode 100755
index 0000000000..cc4c42d801
--- /dev/null
+++ b/ctdb/tests/tool/stubby.lvsmaster.001.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "3 nodes, all ok"
+
+# This isn't very useful, since the stub for capabilities does set LVS :-)
+required_result 255 <<EOF
+There is no LVS master
+EOF
+
+simple_test <<EOF
+NODEMAP
+0 192.168.20.41 0x0 CURRENT RECMASTER
+1 192.168.20.42 0x0
+2 192.168.20.43 0x0
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+EOF
diff --git a/ctdb/tests/tool/stubby.lvsmaster.002.sh b/ctdb/tests/tool/stubby.lvsmaster.002.sh
new file mode 100755
index 0000000000..b45f0cd9f5
--- /dev/null
+++ b/ctdb/tests/tool/stubby.lvsmaster.002.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "3 nodes, current disconnected"
+
+# This isn't very useful, since the stub for capabilities does set LVS :-)
+required_result 10 <<EOF
+DATE TIME [PID]: Unable to get nodemap from local node
+EOF
+
+simple_test -Y <<EOF
+NODEMAP
+0 192.168.20.41 0x1 CURRENT RECMASTER
+1 192.168.20.42 0x0
+2 192.168.20.43 0x0
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+EOF
diff --git a/ctdb/tests/tool/stubby.natgwlist.001.sh b/ctdb/tests/tool/stubby.natgwlist.001.sh
new file mode 100755
index 0000000000..f1d2d37f83
--- /dev/null
+++ b/ctdb/tests/tool/stubby.natgwlist.001.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "3 nodes, all in natgw group, all ok"
+
+setup_natgw <<EOF
+192.168.20.41
+192.168.20.42
+192.168.20.43
+EOF
+
+required_result 0 <<EOF
+0 192.168.20.41
+Number of nodes:3
+pnn:0 192.168.20.41 OK (THIS NODE)
+pnn:1 192.168.20.42 OK
+pnn:2 192.168.20.43 OK
+EOF
+
+simple_test <<EOF
+NODEMAP
+0 192.168.20.41 0x0 CURRENT RECMASTER
+1 192.168.20.42 0x0
+2 192.168.20.43 0x0
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+EOF
diff --git a/ctdb/tests/tool/stubby.natgwlist.002.sh b/ctdb/tests/tool/stubby.natgwlist.002.sh
new file mode 100755
index 0000000000..37f172298c
--- /dev/null
+++ b/ctdb/tests/tool/stubby.natgwlist.002.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "3 nodes, all in natgw group, 1 unhealthy"
+
+setup_natgw <<EOF
+192.168.20.41
+192.168.20.42
+192.168.20.43
+EOF
+
+required_result 0 <<EOF
+1 192.168.20.42
+Number of nodes:3
+pnn:0 192.168.20.41 UNHEALTHY
+pnn:1 192.168.20.42 OK (THIS NODE)
+pnn:2 192.168.20.43 OK
+EOF
+
+simple_test <<EOF
+NODEMAP
+0 192.168.20.41 0x2
+1 192.168.20.42 0x0 CURRENT RECMASTER
+2 192.168.20.43 0x0
+
+VNNMAP
+654321
+0
+1
+2
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+EOF
diff --git a/ctdb/tests/tool/stubby.natgwlist.003.sh b/ctdb/tests/tool/stubby.natgwlist.003.sh
new file mode 100755
index 0000000000..19b1797e25
--- /dev/null
+++ b/ctdb/tests/tool/stubby.natgwlist.003.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "3 nodes, 2 in natgw group, 1 unhealthy"
+
+setup_natgw <<EOF
+192.168.20.41
+192.168.20.43
+EOF
+
+required_result 0 <<EOF
+2 192.168.20.43
+Number of nodes:2
+pnn:0 192.168.20.41 UNHEALTHY
+pnn:2 192.168.20.43 OK
+EOF
+
+simple_test <<EOF
+NODEMAP
+0 192.168.20.41 0x2
+1 192.168.20.42 0x0 CURRENT RECMASTER
+2 192.168.20.43 0x0
+
+VNNMAP
+654321
+0
+1
+2
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+EOF
diff --git a/ctdb/tests/tool/stubby.natgwlist.004.sh b/ctdb/tests/tool/stubby.natgwlist.004.sh
new file mode 100755
index 0000000000..2abec5e18a
--- /dev/null
+++ b/ctdb/tests/tool/stubby.natgwlist.004.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "3 nodes, all unhealthy, all but 1 stopped"
+
+setup_natgw <<EOF
+192.168.20.41
+192.168.20.42
+192.168.20.43
+EOF
+
+required_result 0 <<EOF
+2 192.168.20.43
+Number of nodes:3
+pnn:0 192.168.20.41 UNHEALTHY|STOPPED|INACTIVE
+pnn:1 192.168.20.42 UNHEALTHY|STOPPED|INACTIVE (THIS NODE)
+pnn:2 192.168.20.43 UNHEALTHY
+EOF
+
+simple_test <<EOF
+NODEMAP
+0 192.168.20.41 0x22
+1 192.168.20.42 0x22 CURRENT RECMASTER
+2 192.168.20.43 0x2
+
+VNNMAP
+654321
+0
+1
+2
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+EOF
diff --git a/ctdb/tests/tool/stubby.natgwlist.005.sh b/ctdb/tests/tool/stubby.natgwlist.005.sh
new file mode 100755
index 0000000000..42c7dbbab5
--- /dev/null
+++ b/ctdb/tests/tool/stubby.natgwlist.005.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "3 nodes, all stopped"
+
+setup_natgw <<EOF
+192.168.20.41
+192.168.20.42
+192.168.20.43
+EOF
+
+required_result 0 <<EOF
+0 192.168.20.41
+Number of nodes:3
+pnn:0 192.168.20.41 STOPPED|INACTIVE
+pnn:1 192.168.20.42 STOPPED|INACTIVE (THIS NODE)
+pnn:2 192.168.20.43 STOPPED|INACTIVE
+EOF
+
+simple_test <<EOF
+NODEMAP
+0 192.168.20.41 0x20
+1 192.168.20.42 0x20 CURRENT RECMASTER
+2 192.168.20.43 0x20
+
+VNNMAP
+654321
+0
+1
+2
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+EOF