From f4c2c77ff726dd7d28a7d8c3cd815c802a8a6cfa Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Thu, 5 Mar 2020 21:53:33 +1100 Subject: ctdb-tests: Improve test quality Simplify code, use more modern commands, code improvements (shellcheck). Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- .../INTEGRATION/simple/cluster.010.getrelock.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/ctdb/tests/INTEGRATION/simple/cluster.010.getrelock.sh b/ctdb/tests/INTEGRATION/simple/cluster.010.getrelock.sh index 03cf4317a39..3a766540db8 100755 --- a/ctdb/tests/INTEGRATION/simple/cluster.010.getrelock.sh +++ b/ctdb/tests/INTEGRATION/simple/cluster.010.getrelock.sh @@ -11,17 +11,14 @@ set -e ctdb_test_init echo "Check that recovery lock is set the same on all nodes..." -try_command_on_node -v -q all $CTDB getreclock - -if [ -z "$out" ] ; then - echo "GOOD: Recovery lock is unset on all nodes" - exit 0 -fi +ctdb_onnode all getreclock +# outfile is set above by ctdb_onnode +# shellcheck disable=SC2154 n=$(sort -u "$outfile" | wc -l | tr -d '[:space:]') -if [ "$n" = 1 ] ; then - echo "GOOD: All nodes have the same recovery lock setting" -else - echo "BAD: Recovery lock setting differs across nodes" - exit 1 -fi + +case "$n" in +0) echo "GOOD: Recovery lock is unset on all nodes" ;; +1) echo "GOOD: All nodes have the same recovery lock setting" ;; +*) ctdb_test_fail "BAD: Recovery lock setting differs across nodes" ;; +esac -- cgit v1.2.1