ctdb-tests: Make ctdb natgw tool tests cover all the desired outputs
authorMartin Schwenke <martin@meltin.net>
Mon, 18 Apr 2016 04:47:23 +0000 (14:47 +1000)
committerAmitay Isaacs <amitay@samba.org>
Mon, 25 Apr 2016 05:10:15 +0000 (07:10 +0200)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/tool/stubby.natgw.001.sh [moved from ctdb/tests/tool/stubby.natgwlist.001.sh with 65% similarity]
ctdb/tests/tool/stubby.natgw.002.sh [moved from ctdb/tests/tool/stubby.natgwlist.002.sh with 65% similarity]
ctdb/tests/tool/stubby.natgw.003.sh [moved from ctdb/tests/tool/stubby.natgwlist.003.sh with 64% similarity]
ctdb/tests/tool/stubby.natgw.004.sh [moved from ctdb/tests/tool/stubby.natgwlist.004.sh with 67% similarity]
ctdb/tests/tool/stubby.natgw.005.sh [moved from ctdb/tests/tool/stubby.natgwlist.005.sh with 66% similarity]
ctdb/tests/tool/stubby.natgw.006.sh [moved from ctdb/tests/tool/stubby.natgwlist.006.sh with 66% similarity]
ctdb/tests/tool/stubby.natgw.007.sh [moved from ctdb/tests/tool/stubby.natgwlist.007.sh with 66% similarity]
ctdb/tests/tool/stubby.natgw.008.sh [moved from ctdb/tests/tool/stubby.natgwlist.008.sh with 66% similarity]

similarity index 65%
rename from ctdb/tests/tool/stubby.natgwlist.001.sh
rename to ctdb/tests/tool/stubby.natgw.001.sh
index f1d2d37f834a3eee6f26ba15f8f813073607ed5d..16753d24081ec9362ec2cd86e740d2c87fa1551b 100755 (executable)
@@ -10,15 +10,7 @@ setup_natgw <<EOF
 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
+ctdb_state="\
 NODEMAP
 0       192.168.20.41   0x0     CURRENT RECMASTER
 1       192.168.20.42   0x0
@@ -34,4 +26,38 @@ VNNMAP
 0
 1
 2
+"
+
+#####
+
+required_result 0 <<EOF
+0 192.168.20.41
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+192.168.20.41  MASTER
+192.168.20.42
+192.168.20.43
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+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 status <<EOF
+$ctdb_state
 EOF
similarity index 65%
rename from ctdb/tests/tool/stubby.natgwlist.002.sh
rename to ctdb/tests/tool/stubby.natgw.002.sh
index 37f172298cab0622f8e706f8ded97deab99fbe58..ce36c951afa8cc8531ff40f74af7f2ad0df615ff 100755 (executable)
@@ -10,15 +10,7 @@ setup_natgw <<EOF
 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
+ctdb_state="\
 NODEMAP
 0       192.168.20.41   0x2
 1       192.168.20.42   0x0     CURRENT RECMASTER
@@ -34,4 +26,39 @@ IFACES
 :Name:LinkStatus:References:
 :eth2:1:2:
 :eth1:1:4:
+"
+
+#####
+
+required_result 0 <<EOF
+1 192.168.20.42
+EOF
+
+simple_test master <<EOF
+$ctdb_state
 EOF
+
+#####
+
+required_result 0 <<EOF
+192.168.20.41
+192.168.20.42  MASTER
+192.168.20.43
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+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 status <<EOF
+$ctdb_state
+EOF
+
similarity index 64%
rename from ctdb/tests/tool/stubby.natgwlist.003.sh
rename to ctdb/tests/tool/stubby.natgw.003.sh
index 19b1797e25503d2d96cfd95b8c5d88de3cc4ae01..7d280ac04fb9fc0d19f5cb8f8f426c4774779621 100755 (executable)
@@ -9,14 +9,7 @@ setup_natgw <<EOF
 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
+ctdb_state="\
 NODEMAP
 0       192.168.20.41   0x2
 1       192.168.20.42   0x0     CURRENT RECMASTER
@@ -32,4 +25,36 @@ IFACES
 :Name:LinkStatus:References:
 :eth2:1:2:
 :eth1:1:4:
+"
+
+#####
+
+required_result 0 <<EOF
+2 192.168.20.43
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+192.168.20.41
+192.168.20.43  MASTER
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+pnn:0 192.168.20.41    UNHEALTHY
+pnn:2 192.168.20.43    OK
+EOF
+
+simple_test status <<EOF
+$ctdb_state
 EOF
similarity index 67%
rename from ctdb/tests/tool/stubby.natgwlist.004.sh
rename to ctdb/tests/tool/stubby.natgw.004.sh
index 2abec5e18a1714edb0f920a66cdcdac64651e14a..b4190058564dc1d4245f7010ef5d90fb250593aa 100755 (executable)
@@ -10,15 +10,7 @@ setup_natgw <<EOF
 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
+ctdb_state="\
 NODEMAP
 0       192.168.20.41   0x22
 1       192.168.20.42   0x22     CURRENT RECMASTER
@@ -34,4 +26,38 @@ IFACES
 :Name:LinkStatus:References:
 :eth2:1:2:
 :eth1:1:4:
+"
+
+#####
+
+required_result 0 <<EOF
+2 192.168.20.43
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+192.168.20.41
+192.168.20.42
+192.168.20.43  MASTER
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+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 status <<EOF
+$ctdb_state
 EOF
similarity index 66%
rename from ctdb/tests/tool/stubby.natgwlist.005.sh
rename to ctdb/tests/tool/stubby.natgw.005.sh
index 42c7dbbab58188e4ecdb9acde6ec24bc1e17b17c..10fd4d471258c784d933d77fdc8a0642aa403b91 100755 (executable)
@@ -10,15 +10,7 @@ setup_natgw <<EOF
 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
+ctdb_state="\
 NODEMAP
 0       192.168.20.41   0x20
 1       192.168.20.42   0x20     CURRENT RECMASTER
@@ -34,4 +26,38 @@ IFACES
 :Name:LinkStatus:References:
 :eth2:1:2:
 :eth1:1:4:
+"
+
+#####
+
+required_result 0 <<EOF
+0 192.168.20.41
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+192.168.20.41  MASTER
+192.168.20.42
+192.168.20.43
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+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 status <<EOF
+$ctdb_state
 EOF
similarity index 66%
rename from ctdb/tests/tool/stubby.natgwlist.006.sh
rename to ctdb/tests/tool/stubby.natgw.006.sh
index 6de8e121a53b61f9dc6a5b21706e614181f97285..e120ece4d7eb6908d92cdf2632d433eaf5400f63 100755 (executable)
@@ -10,15 +10,7 @@ setup_natgw <<EOF
 192.168.20.43
 EOF
 
-required_result 0 <<EOF
-1 192.168.20.42
-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
+ctdb_state="\
 NODEMAP
 0       192.168.20.41   0x20
 1       192.168.20.42   0x20    CURRENT RECMASTER
@@ -34,4 +26,38 @@ IFACES
 :Name:LinkStatus:References:
 :eth2:1:2:
 :eth1:1:4:
+"
+
+#####
+
+required_result 0 <<EOF
+1 192.168.20.42
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+192.168.20.41  slave-only
+192.168.20.42  MASTER
+192.168.20.43
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+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 status <<EOF
+$ctdb_state
 EOF
similarity index 66%
rename from ctdb/tests/tool/stubby.natgwlist.007.sh
rename to ctdb/tests/tool/stubby.natgw.007.sh
index 563d86737fcc62b74593dc7418361f9d0e618747..9fac6bdfe83cd2a176ddef577f078c79949a8261 100755 (executable)
@@ -10,15 +10,7 @@ setup_natgw <<EOF
 192.168.20.43  slave-only
 EOF
 
-required_result 2 <<EOF
--1 0.0.0.0
-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
+ctdb_state="\
 NODEMAP
 0       192.168.20.41   0x20
 1       192.168.20.42   0x20    CURRENT RECMASTER
@@ -34,4 +26,37 @@ IFACES
 :Name:LinkStatus:References:
 :eth2:1:2:
 :eth1:1:4:
+"
+
+#####
+
+required_result 2 <<EOF
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+192.168.20.41  slave-only
+192.168.20.42  slave-only
+192.168.20.43  slave-only
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+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 status <<EOF
+$ctdb_state
 EOF
similarity index 66%
rename from ctdb/tests/tool/stubby.natgwlist.008.sh
rename to ctdb/tests/tool/stubby.natgw.008.sh
index e213400ff9a4f4b07b4d6eda4b05e0b4695d278e..14e2c8479396cea1770c7cb28d3575789a528ef5 100755 (executable)
@@ -10,15 +10,7 @@ setup_natgw <<EOF
 192.168.20.43
 EOF
 
-required_result 0 <<EOF
-1 192.168.20.42
-Number of nodes:3
-pnn:0 192.168.20.41    DISCONNECTED|INACTIVE
-pnn:1 192.168.20.42    OK (THIS NODE)
-pnn:2 192.168.20.43    OK
-EOF
-
-simple_test <<EOF
+ctdb_state="\
 NODEMAP
 0       192.168.20.41   0x1
 1       192.168.20.42   0x0     CURRENT RECMASTER
@@ -34,4 +26,38 @@ IFACES
 :Name:LinkStatus:References:
 :eth2:1:2:
 :eth1:1:4:
+"
+
+#####
+
+required_result 0 <<EOF
+1 192.168.20.42
+EOF
+
+simple_test master <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+192.168.20.41
+192.168.20.42  MASTER
+192.168.20.43
+EOF
+
+simple_test list <<EOF
+$ctdb_state
+EOF
+
+#####
+
+required_result 0 <<EOF
+pnn:0 192.168.20.41    DISCONNECTED|INACTIVE
+pnn:1 192.168.20.42    OK (THIS NODE)
+pnn:2 192.168.20.43    OK
+EOF
+
+simple_test status <<EOF
+$ctdb_state
 EOF