diff options
author | Martin Schwenke <martin@meltin.net> | 2020-03-05 21:53:33 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2020-07-22 02:42:38 +0000 |
commit | a308f2534d3991866efa2c662921ec63b4238888 (patch) | |
tree | 9a429500602d0078da6bb4731bb6e686d87ee28f | |
parent | 1f6556916e7f3a731d7d760fa6fd857e7f571541 (diff) | |
download | samba-a308f2534d3991866efa2c662921ec63b4238888.tar.gz |
ctdb-tests: Improve test quality
Simplify code, use more modern commands, code improvements (shellcheck).
Signed-off-by: Martin Schwenke <martin@meltin.net>
-rwxr-xr-x | ctdb/tests/INTEGRATION/simple/cluster.010.getrelock.sh | 21 |
1 files 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 |