diff options
author | Martin Schwenke <martin@meltin.net> | 2011-06-07 16:05:48 +1000 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2011-08-03 15:51:44 +1000 |
commit | 3ee6a63e47fb07d34221c8e2c6df71ee4709e657 (patch) | |
tree | a27c168b1c1d5dc6f28d5956cd6a3dcc0e8500d4 /ctdb/tests/onnode | |
parent | 51ef4b4e5548ad952f3476f2743016470680ae6e (diff) | |
download | samba-3ee6a63e47fb07d34221c8e2c6df71ee4709e657.tar.gz samba-3ee6a63e47fb07d34221c8e2c6df71ee4709e657.tar.xz samba-3ee6a63e47fb07d34221c8e2c6df71ee4709e657.zip |
Tests: onnode tests changed to use a simple define_test() function.
This makes global changes easier.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 3af086398fecb5f7c501190f9620b9c7b201f0ca)
Diffstat (limited to 'ctdb/tests/onnode')
-rwxr-xr-x | ctdb/tests/onnode/0001.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0002.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0003.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0004.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0005.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0006.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0070.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0071.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0072.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0075.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0080.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0081.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0090.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0091.sh | 2 | ||||
-rw-r--r-- | ctdb/tests/onnode/common.sh | 10 |
15 files changed, 24 insertions, 14 deletions
diff --git a/ctdb/tests/onnode/0001.sh b/ctdb/tests/onnode/0001.sh index 6c86ac1212..3c2d541ef4 100755 --- a/ctdb/tests/onnode/0001.sh +++ b/ctdb/tests/onnode/0001.sh @@ -4,7 +4,7 @@ cmd="$ONNODE all hostname" -echo "$cmd - all nodes OK" +define_test "$cmd" "all nodes OK" required_result <<EOF diff --git a/ctdb/tests/onnode/0002.sh b/ctdb/tests/onnode/0002.sh index e8e082daec..b18d91efa2 100755 --- a/ctdb/tests/onnode/0002.sh +++ b/ctdb/tests/onnode/0002.sh @@ -4,7 +4,7 @@ cmd="$ONNODE -q all hostname" -echo "$cmd - all nodes OK" +define_test "$cmd" "all nodes OK" required_result <<EOF -n 192.168.1.101 hostname diff --git a/ctdb/tests/onnode/0003.sh b/ctdb/tests/onnode/0003.sh index 7e55c6015f..d925799261 100755 --- a/ctdb/tests/onnode/0003.sh +++ b/ctdb/tests/onnode/0003.sh @@ -4,7 +4,7 @@ cmd="$ONNODE -p all hostname" -echo "$cmd - all nodes OK" +define_test "$cmd" "all nodes OK" required_result <<EOF [192.168.1.101] -n 192.168.1.101 hostname diff --git a/ctdb/tests/onnode/0004.sh b/ctdb/tests/onnode/0004.sh index daa6794811..a6e6424ace 100755 --- a/ctdb/tests/onnode/0004.sh +++ b/ctdb/tests/onnode/0004.sh @@ -4,7 +4,7 @@ cmd="$ONNODE -pq all hostname" -echo "$cmd - all nodes OK" +define_test "$cmd" "all nodes OK" required_result <<EOF -n 192.168.1.101 hostname diff --git a/ctdb/tests/onnode/0005.sh b/ctdb/tests/onnode/0005.sh index bb82166f3c..af237da9a3 100755 --- a/ctdb/tests/onnode/0005.sh +++ b/ctdb/tests/onnode/0005.sh @@ -4,7 +4,7 @@ cmd="$ONNODE 3 hostname" -echo "$cmd - all nodes OK" +define_test "$cmd" "all nodes OK" required_result <<EOF -n 192.168.1.104 hostname diff --git a/ctdb/tests/onnode/0006.sh b/ctdb/tests/onnode/0006.sh index 2960061d46..aa6eeba89e 100755 --- a/ctdb/tests/onnode/0006.sh +++ b/ctdb/tests/onnode/0006.sh @@ -4,7 +4,7 @@ cmd="$ONNODE -v 3 hostname" -echo "$cmd - all nodes OK" +define_test "$cmd" "all nodes OK" required_result <<EOF diff --git a/ctdb/tests/onnode/0070.sh b/ctdb/tests/onnode/0070.sh index 758298124f..f38c95f5fd 100755 --- a/ctdb/tests/onnode/0070.sh +++ b/ctdb/tests/onnode/0070.sh @@ -4,7 +4,7 @@ cmd="$ONNODE ok hostname" -echo "$cmd - all nodes OK" +define_test "$cmd" "all nodes OK" ctdb_set_output <<EOF :Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive: diff --git a/ctdb/tests/onnode/0071.sh b/ctdb/tests/onnode/0071.sh index 3c0a7748e9..8a1cb59dd7 100755 --- a/ctdb/tests/onnode/0071.sh +++ b/ctdb/tests/onnode/0071.sh @@ -4,7 +4,7 @@ cmd="$ONNODE ok hostname" -echo "$cmd - 2nd node disconnected" +define_test "$cmd" "2nd node disconnected" ctdb_set_output <<EOF ctdb_set_output <<EOF diff --git a/ctdb/tests/onnode/0072.sh b/ctdb/tests/onnode/0072.sh index a8c7d07329..d80361a435 100755 --- a/ctdb/tests/onnode/0072.sh +++ b/ctdb/tests/onnode/0072.sh @@ -4,7 +4,7 @@ cmd="$ONNODE ok hostname" -echo "$cmd - 2nd node disconnected, extra status columns" +define_test "$cmd" "2nd node disconnected, extra status columns" ctdb_set_output <<EOF :Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive:X1:X2:X3:X4: diff --git a/ctdb/tests/onnode/0075.sh b/ctdb/tests/onnode/0075.sh index 8315f78dbf..aa2e8be0ba 100755 --- a/ctdb/tests/onnode/0075.sh +++ b/ctdb/tests/onnode/0075.sh @@ -4,7 +4,7 @@ cmd="$ONNODE con hostname" -echo "$cmd - 1st node disconnected" +define_test "$cmd" "1st node disconnected" ctdb_set_output <<EOF :Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive: diff --git a/ctdb/tests/onnode/0080.sh b/ctdb/tests/onnode/0080.sh index f04155455d..095f65b224 100755 --- a/ctdb/tests/onnode/0080.sh +++ b/ctdb/tests/onnode/0080.sh @@ -4,7 +4,7 @@ cmd="$ONNODE recmaster hostname" -echo "$cmd - node 1 (192.168.1.102) is recmaster" +define_test "$cmd" "node 1 (192.168.1.102) is recmaster" ctdb_set_output <<EOF 1 diff --git a/ctdb/tests/onnode/0081.sh b/ctdb/tests/onnode/0081.sh index c31af289d6..e593934f66 100755 --- a/ctdb/tests/onnode/0081.sh +++ b/ctdb/tests/onnode/0081.sh @@ -4,7 +4,7 @@ cmd="$ONNODE lvsmaster hostname" -echo "$cmd - no lvsmaster" +define_test "$cmd" "no lvsmaster" ctdb_set_output 255 <<EOF There is no LVS master diff --git a/ctdb/tests/onnode/0090.sh b/ctdb/tests/onnode/0090.sh index c64c1587c9..1147e34c10 100755 --- a/ctdb/tests/onnode/0090.sh +++ b/ctdb/tests/onnode/0090.sh @@ -4,7 +4,7 @@ cmd="$ONNODE natgw hostname" -echo "$cmd - no natgw" +define_test "$cmd" "no natgw" ctdb_set_output <<EOF -1 0.0.0.0 diff --git a/ctdb/tests/onnode/0091.sh b/ctdb/tests/onnode/0091.sh index 947760647a..5239eef1b4 100755 --- a/ctdb/tests/onnode/0091.sh +++ b/ctdb/tests/onnode/0091.sh @@ -4,7 +4,7 @@ cmd="$ONNODE natgw hostname" -echo "$cmd - node 2 (192.168.1.103) is natgw" +define_test "$cmd" "node 2 (192.168.1.103) is natgw" ctdb_set_output <<EOF 2 192.168.1.103 diff --git a/ctdb/tests/onnode/common.sh b/ctdb/tests/onnode/common.sh index bbdbce4777..e4cca32162 100644 --- a/ctdb/tests/onnode/common.sh +++ b/ctdb/tests/onnode/common.sh @@ -42,6 +42,16 @@ if [ -z "$CTDB_BASE" ] ; then export CTDB_BASE=$(dirname "$CTDB_NODES_FILE") fi +define_test () +{ + _f="$0" + _f="${_f#./}" # strip leading ./ + _f="${_f%%/*}" # if subdir, strip off file + _f="${_f%.sh}" # strip off .sh suffix if any + + echo "$_f $1 - $2" +} + # Set output for ctdb command. Option 1st argument is return code. ctdb_set_output () { |