From c607989d91b64d837253aae794b1a3d6013eb3e0 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Mon, 19 Oct 2015 16:05:44 +1100 Subject: [PATCH] ctdb-tests: Drop simple uses of "ctdb -n all ..." from simple tests None of these uses of -n are particularly useful. "-n all" will be deprecated. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/tests/simple/06_ctdb_getpid.sh | 10 +--------- ctdb/tests/simple/12_ctdb_getdebug.sh | 10 ++-------- ctdb/tests/simple/14_ctdb_statistics.sh | 7 +------ ctdb/tests/simple/23_ctdb_moveip.sh | 4 ++-- ctdb/tests/simple/25_dumpmemory.sh | 17 ----------------- ctdb/tests/simple/35_set_recmaster.sh | 18 +++++++++--------- ctdb/tests/simple/scripts/local_daemons.bash | 2 +- 7 files changed, 16 insertions(+), 52 deletions(-) diff --git a/ctdb/tests/simple/06_ctdb_getpid.sh b/ctdb/tests/simple/06_ctdb_getpid.sh index 7152ad41710..30137343140 100755 --- a/ctdb/tests/simple/06_ctdb_getpid.sh +++ b/ctdb/tests/simple/06_ctdb_getpid.sh @@ -15,8 +15,6 @@ Steps: 2. Run 'ctdb getpid -n ' on the nodes to check the PID of the ctdbd process. 3. Verify that the output is valid. -4. Verify that with the '-n all' option the command shows the PIDs on - all the nodes Expected results: @@ -32,8 +30,6 @@ set -e cluster_is_healthy -# This is an attempt at being independent of the number of nodes -# reported by "ctdb getpid -n all". try_command_on_node 0 "$CTDB listnodes | wc -l" num_nodes="$out" echo "There are $num_nodes nodes..." @@ -43,9 +39,6 @@ echo "There are $num_nodes nodes..." try_command_on_node -v 0 "onnode -q all $CTDB getpid" pids_onnode="$out" -try_command_on_node -v 0 "$CTDB getpid -n all" -pids_getpid_all="$out" - cmd="" n=0 while [ $n -lt $num_nodes ] ; do @@ -55,8 +48,7 @@ done try_command_on_node -v 0 "( $cmd )" pids_getpid_n="$out" -if [ "$pids_onnode" = "$pids_getpid_all" -a \ - "$pids_getpid_all" = "$pids_getpid_n" ] ; then +if [ "$pids_onnode" = "$pids_getpid_n" ] ; then echo "They're the same... cool!" else echo "Error: they differ." diff --git a/ctdb/tests/simple/12_ctdb_getdebug.sh b/ctdb/tests/simple/12_ctdb_getdebug.sh index cdd9e342e72..39028ac8e3b 100755 --- a/ctdb/tests/simple/12_ctdb_getdebug.sh +++ b/ctdb/tests/simple/12_ctdb_getdebug.sh @@ -13,8 +13,6 @@ Steps: 1. Verify that the status on all of the ctdb nodes is 'OK'. 2. Get the current debug level on a node, using 'ctdb getdebug -n '. -3. Verify that pipe-separated output is generated with the -X option. -4. Verify that the '-n all' option shows the debug level on all nodes. Expected results: @@ -41,9 +39,6 @@ sanity_check_output \ '^Node [[:digit:]]+ is at debug level [[:alpha:]]+ \([[:digit:]]+\)$' \ "$out" -try_command_on_node -v 1 "$CTDB getdebug -n all" -getdebug_all="$out" - cmd="" n=0 while [ $n -lt $num_nodes ] ; do @@ -53,8 +48,7 @@ done try_command_on_node -v 1 "$cmd" getdebug_n="$out" -if [ "$getdebug_onnode" = "$getdebug_all" -a \ - "$getdebug_all" = "$getdebug_n" ] ; then +if [ "$getdebug_onnode" = "$getdebug_n" ] ; then echo "They're the same... cool!" else echo "Error: they differ." @@ -69,7 +63,7 @@ while read line ; do seps="${seps}${seps:+${nl}}|Name|Level|${nl}${t}" done <<<"$getdebug_onnode" -cmd="$CTDB -X getdebug -n all" +cmd="onnode -q all $CTDB -X getdebug" echo "Checking that \"$cmd\" produces expected output..." try_command_on_node 1 "$cmd" diff --git a/ctdb/tests/simple/14_ctdb_statistics.sh b/ctdb/tests/simple/14_ctdb_statistics.sh index 9cc5ac15cc9..3dd55e05cd3 100755 --- a/ctdb/tests/simple/14_ctdb_statistics.sh +++ b/ctdb/tests/simple/14_ctdb_statistics.sh @@ -1,3 +1,4 @@ + #!/bin/bash test_info() @@ -16,8 +17,6 @@ Steps: 1. Verify that the status on all of the ctdb nodes is 'OK'. 2. Run 'ctdb statistics' on a node, and verify that the output is valid. -3. Repeat the command with the '-n all' option and verify that the - output is valid. Expected results: @@ -38,7 +37,3 @@ pattern='^(CTDB version 1|Current time of statistics[[:space:]]*:.*|Statistics c try_command_on_node -v 1 "$CTDB statistics" sanity_check_output 40 "$pattern" "$out" - -try_command_on_node -v 1 "$CTDB statistics -n all" - -sanity_check_output 40 "$pattern" "$out" diff --git a/ctdb/tests/simple/23_ctdb_moveip.sh b/ctdb/tests/simple/23_ctdb_moveip.sh index f6e90272b2a..f92d7f78ee6 100755 --- a/ctdb/tests/simple/23_ctdb_moveip.sh +++ b/ctdb/tests/simple/23_ctdb_moveip.sh @@ -50,10 +50,10 @@ fi echo "Target node is ${to_node}" echo "Turning off DeterministicIPs..." -try_command_on_node 0 $CTDB setvar DeterministicIPs 0 -n all +try_command_on_node -q all $CTDB setvar DeterministicIPs 0 echo "Turning on NoIPFailback..." -try_command_on_node 0 $CTDB setvar NoIPFailback 1 -n all +try_command_on_node -q all $CTDB setvar NoIPFailback 1 echo "Attempting to move ${test_ip} from node ${test_node} to node ${to_node}" try_command_on_node $test_node $CTDB moveip $test_ip $to_node diff --git a/ctdb/tests/simple/25_dumpmemory.sh b/ctdb/tests/simple/25_dumpmemory.sh index 4082da1d130..4d6cc83d5ee 100755 --- a/ctdb/tests/simple/25_dumpmemory.sh +++ b/ctdb/tests/simple/25_dumpmemory.sh @@ -13,8 +13,6 @@ Steps: 1. Verify that the status on all of the ctdb nodes is 'OK'. 2. Run 'ctdb dumpmemory' and verify that it shows expected output -3. Verify that the command takes the '-n all' option and that it - causes output for all nodes to be displayed. Expected results: @@ -35,18 +33,3 @@ try_command_on_node -v 0 "$CTDB dumpmemory" pat='^([[:space:]].+[[:space:]]+contains[[:space:]]+[[:digit:]]+ bytes in[[:space:]]+[[:digit:]]+ blocks \(ref [[:digit:]]+\)[[:space:]]+0x[[:xdigit:]]+|[[:space:]]+reference to: .+|full talloc report on .+ \(total[[:space:]]+[[:digit:]]+ bytes in [[:digit:]]+ blocks\))$' sanity_check_output 10 "$pat" "$out" - -echo "Checking output using '-n all'..." - -try_command_on_node 0 "$CTDB listnodes" -num_nodes=$(echo "$out" | wc -l) - -try_command_on_node 0 "$CTDB dumpmemory" -n all -sanity_check_output 10 "$pat" "$out" - -if [ $(fgrep -c 'full talloc report on' <<<"$out") -eq $num_nodes ] ; then - echo "OK: there looks to be output for all $num_nodes nodes" -else - echo "BAD: there not look to be output for all $num_nodes nodes" - exit 1 -fi diff --git a/ctdb/tests/simple/35_set_recmaster.sh b/ctdb/tests/simple/35_set_recmaster.sh index 7c745e4dcfd..fe788094d56 100755 --- a/ctdb/tests/simple/35_set_recmaster.sh +++ b/ctdb/tests/simple/35_set_recmaster.sh @@ -43,7 +43,7 @@ wait_until_generation_has_changed () } echo "Check that recovery lock is set the same on all nodes..." -try_command_on_node -v any $CTDB -n all getreclock +try_command_on_node -v -q all $CTDB getreclock n=$(echo "$out" | sort -u | wc -l) if [ "$n" = 1 ] ; then echo "GOOD: All nodes have the same recovery lock setting" @@ -68,8 +68,8 @@ echo "Remember original recovery lock file: \"${orig_reclock}\"" echo echo "Unset and test the recovery lock on all nodes..." -try_command_on_node any $CTDB -n all setreclock -try_command_on_node -v any $CTDB -n all getreclock +try_command_on_node -q all $CTDB setreclock +try_command_on_node -v -q all $CTDB getreclock t=$(sort -u <<<"$out") if [ "$t" = "No reclock file used." ] ; then echo "GOOD: Recovery lock unset on all nodes" @@ -85,14 +85,14 @@ echo "Current generation is ${generation}" alt="${orig_reclock}.test" echo echo "Set alternative recovery lock (${alt}) and test on all nodes..." -try_command_on_node any $CTDB -n all setreclock "$alt" -try_command_on_node -v any $CTDB -n all getreclock +try_command_on_node -q all $CTDB setreclock "$alt" +try_command_on_node -v -q all $CTDB getreclock t=$(echo "$out" | sed -e 's@^Reclock file:@@' | sort -u) if [ "$t" = "$alt" ] ; then echo "GOOD: Recovery lock set on all nodes" else echo "BAD: Recovery lock not set on all nodes" - try_command_on_node -v any rm -v "$alt" || true + try_command_on_node -vf all rm -v "$alt" || true exit 1 fi @@ -102,9 +102,9 @@ echo "Current generation is ${generation}" echo echo "Restore and test the recovery lock on all nodes..." -try_command_on_node any $CTDB -n all setreclock "$orig_reclock" -try_command_on_node -v any rm -v "$alt" -try_command_on_node -v any $CTDB -n all getreclock +try_command_on_node -q all $CTDB setreclock "$orig_reclock" +try_command_on_node -v all rm -vf "$alt" +try_command_on_node -v -q all $CTDB getreclock t=$(echo "$out" | sed -e 's@^Reclock file:@@' | sort -u) if [ "$t" = "$orig_reclock" ] ; then echo "GOOD: Recovery lock restored on all nodes" diff --git a/ctdb/tests/simple/scripts/local_daemons.bash b/ctdb/tests/simple/scripts/local_daemons.bash index 5071b1e784c..92ec3910fdb 100644 --- a/ctdb/tests/simple/scripts/local_daemons.bash +++ b/ctdb/tests/simple/scripts/local_daemons.bash @@ -22,7 +22,7 @@ export CTDB_NODES="${TEST_VAR_DIR}/nodes.txt" daemons_stop () { echo "Attempting to politely shutdown daemons..." - onnode 1 $CTDB shutdown -n all || true + onnode -q all $CTDB shutdown || true echo "Sleeping for a while..." sleep_for 1