summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/tool
diff options
context:
space:
mode:
Diffstat (limited to 'ctdb/tests/tool')
-rw-r--r--ctdb/tests/tool/README17
-rwxr-xr-xctdb/tests/tool/func.parse_nodestring.001.sh16
-rwxr-xr-xctdb/tests/tool/func.parse_nodestring.002.sh16
-rwxr-xr-xctdb/tests/tool/func.parse_nodestring.003.sh15
-rw-r--r--ctdb/tests/tool/scripts/local.sh56
-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
-rwxr-xr-xctdb/tests/tool/stubby.nodestatus.001.sh30
-rwxr-xr-xctdb/tests/tool/stubby.nodestatus.002.sh30
-rwxr-xr-xctdb/tests/tool/stubby.nodestatus.003.sh30
-rwxr-xr-xctdb/tests/tool/stubby.nodestatus.004.sh31
-rwxr-xr-xctdb/tests/tool/stubby.nodestatus.005.sh34
-rwxr-xr-xctdb/tests/tool/stubby.status.001.sh37
-rwxr-xr-xctdb/tests/tool/stubby.status.002.sh37
-rwxr-xr-xctdb/tests/tool/testcases/stubby.nodestatus.005.sh34
24 files changed, 736 insertions, 0 deletions
diff --git a/ctdb/tests/tool/README b/ctdb/tests/tool/README
new file mode 100644
index 00000000000..816052862fd
--- /dev/null
+++ b/ctdb/tests/tool/README
@@ -0,0 +1,17 @@
+Unit tests for the ctdb tool (i.e. tools/ctdb).
+
+Test case filenames can take 2 forms:
+
+* func.<some_function>.NNN.sh
+
+ Run <some_function> in the ctdb tool code using the
+ ctdb_tool_functest test program. This test program uses test stubs
+ for CTDB client functions.
+
+* stubby.<command>.NNN.sh
+
+ Run the ctdb_tool_stubby test program with <command> as the 1st
+ argument - subsequent are passed to simple_test(). ctdb_tool_stubby
+ is linked against the test stubs for CTDB client functions.
+
+To add tests here you may need to add appropriate test stubs.
diff --git a/ctdb/tests/tool/func.parse_nodestring.001.sh b/ctdb/tests/tool/func.parse_nodestring.001.sh
new file mode 100755
index 00000000000..d7caf89da98
--- /dev/null
+++ b/ctdb/tests/tool/func.parse_nodestring.001.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "all, dd_ok, 3 healthy"
+
+required_result <<EOF
+NODES: 0 1 2
+PNN MODE: BROADCAST_ALL (4026531842)
+EOF
+
+simple_test all true <<EOF
+0 192.168.20.41 0x0
+1 192.168.20.42 0x0
+2 192.168.20.43 0x0 CURRENT RECMASTER
+EOF
diff --git a/ctdb/tests/tool/func.parse_nodestring.002.sh b/ctdb/tests/tool/func.parse_nodestring.002.sh
new file mode 100755
index 00000000000..c89e444eaf0
--- /dev/null
+++ b/ctdb/tests/tool/func.parse_nodestring.002.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "all, dd_ok, 2 ok/1 disconnected"
+
+required_result <<EOF
+NODES: 0 1 2
+PNN MODE: BROADCAST_ALL (4026531842)
+EOF
+
+simple_test all true <<EOF
+0 192.168.20.41 0x0
+1 192.168.20.42 0x1
+2 192.168.20.43 0x0 CURRENT RECMASTER
+EOF
diff --git a/ctdb/tests/tool/func.parse_nodestring.003.sh b/ctdb/tests/tool/func.parse_nodestring.003.sh
new file mode 100755
index 00000000000..3e03ac40419
--- /dev/null
+++ b/ctdb/tests/tool/func.parse_nodestring.003.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "all, current disconnected"
+
+required_result 10 <<EOF
+DATE TIME [PID]: Unable to get nodemap from local node
+EOF
+
+simple_test all true <<EOF
+0 192.168.20.41 0x0
+1 192.168.20.42 0x0
+2 192.168.20.43 0x1 CURRENT RECMASTER
+EOF
diff --git a/ctdb/tests/tool/scripts/local.sh b/ctdb/tests/tool/scripts/local.sh
new file mode 100644
index 00000000000..385e2ad64b4
--- /dev/null
+++ b/ctdb/tests/tool/scripts/local.sh
@@ -0,0 +1,56 @@
+# Hey Emacs, this is a -*- shell-script -*- !!! :-)
+
+if "$TEST_VERBOSE" ; then
+ debug () { echo "$@" ; }
+else
+ debug () { : ; }
+fi
+
+define_test ()
+{
+ _f=$(basename "$0" ".sh")
+
+ case "$_f" in
+ func.*)
+ _func="${_f#func.}"
+ _func="${_func%.*}" # Strip test number
+ test_prog="ctdb_functest ${_func}"
+ ;;
+ stubby.*)
+ _cmd="${_f#stubby.}"
+ _cmd="${_cmd%.*}" # Strip test number
+ test_prog="ctdb_stubtest ${_cmd}"
+ ;;
+ *)
+ die "Unknown pattern for testcase \"$_f\""
+ esac
+
+ printf "%-28s - %s\n" "$_f" "$1"
+}
+
+setup_natgw ()
+{
+ debug "Setting up NAT gateway"
+
+ natgw_config_dir="${TEST_VAR_DIR}/natgw_config"
+ mkdir -p "$natgw_config_dir"
+
+ # These will accumulate, 1 per test... but will be cleaned up at
+ # the end.
+ export CTDB_NATGW_NODES=$(mktemp --tmpdir="$natgw_config_dir")
+
+ cat >"$CTDB_NATGW_NODES"
+}
+
+simple_test ()
+{
+ # Most of the tests when the tool fails will have a date/time/pid
+ # prefix. Strip that because it isn't possible to match it.
+ if [ $required_rc -ne 0 ] ; then
+ OUT_FILTER='s@^[0-9/]+\ [0-9:\.]+\ \[[\ 0-9]+\]:@DATE\ TIME\ \[PID\]:@'
+ fi
+
+ _out=$($VALGRIND $test_prog "$@" 2>&1)
+
+ result_check
+}
diff --git a/ctdb/tests/tool/stubby.getcapabilities.001.sh b/ctdb/tests/tool/stubby.getcapabilities.001.sh
new file mode 100755
index 00000000000..df4a659008f
--- /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 00000000000..9a37c4a93ec
--- /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 00000000000..33b1b74a203
--- /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 00000000000..29e9ce0cdc3
--- /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 00000000000..38de280e348
--- /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 doesn't 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 00000000000..ea6e441496d
--- /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 doesn't 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 00000000000..f1d2d37f834
--- /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 00000000000..37f172298ca
--- /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 00000000000..19b1797e255
--- /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 00000000000..2abec5e18a1
--- /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 00000000000..42c7dbbab58
--- /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
diff --git a/ctdb/tests/tool/stubby.nodestatus.001.sh b/ctdb/tests/tool/stubby.nodestatus.001.sh
new file mode 100755
index 00000000000..6392b8d1ecc
--- /dev/null
+++ b/ctdb/tests/tool/stubby.nodestatus.001.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "all, 3 nodes, all OK"
+
+required_result 0 <<EOF
+Number of nodes:3
+pnn:0 192.168.20.41 OK
+pnn:1 192.168.20.42 OK
+pnn:2 192.168.20.43 OK (THIS NODE)
+EOF
+
+simple_test all <<EOF
+NODEMAP
+0 192.168.20.41 0x0
+1 192.168.20.42 0x0
+2 192.168.20.43 0x0 CURRENT RECMASTER
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+EOF
diff --git a/ctdb/tests/tool/stubby.nodestatus.002.sh b/ctdb/tests/tool/stubby.nodestatus.002.sh
new file mode 100755
index 00000000000..f5b1909a07c
--- /dev/null
+++ b/ctdb/tests/tool/stubby.nodestatus.002.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "-n all, 3 nodes, all OK"
+
+required_result 0 <<EOF
+Number of nodes:3
+pnn:0 192.168.20.41 OK
+pnn:1 192.168.20.42 OK
+pnn:2 192.168.20.43 OK (THIS NODE)
+EOF
+
+simple_test all <<EOF
+NODEMAP
+0 192.168.20.41 0x0
+1 192.168.20.42 0x0
+2 192.168.20.43 0x0 CURRENT RECMASTER
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+EOF
diff --git a/ctdb/tests/tool/stubby.nodestatus.003.sh b/ctdb/tests/tool/stubby.nodestatus.003.sh
new file mode 100755
index 00000000000..a3a7a42e434
--- /dev/null
+++ b/ctdb/tests/tool/stubby.nodestatus.003.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "all, 3 nodes, 1 disconnected"
+
+required_result 1 <<EOF
+Number of nodes:3
+pnn:0 192.168.20.41 OK
+pnn:1 192.168.20.42 DISCONNECTED|INACTIVE
+pnn:2 192.168.20.43 OK (THIS NODE)
+EOF
+
+simple_test all <<EOF
+NODEMAP
+0 192.168.20.41 0x0
+1 192.168.20.42 0x1
+2 192.168.20.43 0x0 CURRENT RECMASTER
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+EOF
diff --git a/ctdb/tests/tool/stubby.nodestatus.004.sh b/ctdb/tests/tool/stubby.nodestatus.004.sh
new file mode 100755
index 00000000000..bc9890590c9
--- /dev/null
+++ b/ctdb/tests/tool/stubby.nodestatus.004.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "-n all, 3 nodes, 1 disconnected"
+
+# -n all asks each node for the node status and
+# thus reports THIS NODE for each node
+
+required_result 0 <<EOF
+pnn:0 192.168.20.41 OK (THIS NODE)
+pnn:2 192.168.20.43 OK (THIS NODE)
+EOF
+
+simple_test -n all <<EOF
+NODEMAP
+0 192.168.20.41 0x0
+1 192.168.20.42 0x1
+2 192.168.20.43 0x0 CURRENT RECMASTER
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+EOF
diff --git a/ctdb/tests/tool/stubby.nodestatus.005.sh b/ctdb/tests/tool/stubby.nodestatus.005.sh
new file mode 100755
index 00000000000..cb532e7c827
--- /dev/null
+++ b/ctdb/tests/tool/stubby.nodestatus.005.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "-n all all, 3 nodes, 1 disconnected"
+
+required_result 1 <<EOF
+Number of nodes:3
+pnn:0 192.168.20.41 OK (THIS NODE)
+pnn:1 192.168.20.42 DISCONNECTED|INACTIVE
+pnn:2 192.168.20.43 OK
+Number of nodes:3
+pnn:0 192.168.20.41 OK
+pnn:1 192.168.20.42 DISCONNECTED|INACTIVE
+pnn:2 192.168.20.43 OK (THIS NODE)
+EOF
+
+simple_test -n all all <<EOF
+NODEMAP
+0 192.168.20.41 0x0
+1 192.168.20.42 0x1
+2 192.168.20.43 0x0 CURRENT RECMASTER
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+EOF
diff --git a/ctdb/tests/tool/stubby.status.001.sh b/ctdb/tests/tool/stubby.status.001.sh
new file mode 100755
index 00000000000..48b5bac24a9
--- /dev/null
+++ b/ctdb/tests/tool/stubby.status.001.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "all, 3 nodes, all ok"
+
+required_result 0 <<EOF
+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
+Generation:654321
+Size:3
+hash:0 lmaster:0
+hash:1 lmaster:1
+hash:2 lmaster:2
+Recovery mode:NORMAL (0)
+Recovery master:0
+EOF
+
+simple_test all <<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.status.002.sh b/ctdb/tests/tool/stubby.status.002.sh
new file mode 100755
index 00000000000..fceceb30e0d
--- /dev/null
+++ b/ctdb/tests/tool/stubby.status.002.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "all, 3 nodes, 1 unhealthy"
+
+required_result 0 <<EOF
+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
+Generation:654321
+Size:3
+hash:0 lmaster:0
+hash:1 lmaster:1
+hash:2 lmaster:2
+Recovery mode:NORMAL (0)
+Recovery master:1
+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/testcases/stubby.nodestatus.005.sh b/ctdb/tests/tool/testcases/stubby.nodestatus.005.sh
new file mode 100755
index 00000000000..a18608dd4b8
--- /dev/null
+++ b/ctdb/tests/tool/testcases/stubby.nodestatus.005.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+. "${TESTS_SUBDIR}/common.sh"
+
+define_test "-n all all, 3 nodes, 1 disconnected"
+
+required_result 1 <<EOF
+Number of nodes:3
+pnn:0 192.168.20.41 OK (THIS NODE)
+pnn:1 192.168.20.42 DISCONNECTED|INACTIVE
+pnn:2 192.168.20.43 OK
+Number of nodes:3
+pnn:0 192.168.20.41 OK
+pnn:1 192.168.20.42 DISCONNECTED|INACTIVE
+pnn:2 192.168.20.43 OK (THIS NODE)
+EOF
+
+simple_test -n all all <<EOF
+NODEMAP
+0 192.168.20.41 0x0
+1 192.168.20.42 0x1
+2 192.168.20.43 0x0 CURRENT RECMASTER
+
+IFACES
+:Name:LinkStatus:References:
+:eth2:1:2:
+:eth1:1:4:
+
+VNNMAP
+654321
+0
+1
+2
+EOF