diff options
author | Martin Schwenke <martin@meltin.net> | 2020-03-05 21:53:33 +1100 |
---|---|---|
committer | Martin Schwenke <martins@samba.org> | 2020-07-22 07:53:36 +0000 |
commit | f4c2c77ff726dd7d28a7d8c3cd815c802a8a6cfa (patch) | |
tree | abad1e3f4cc69af1eb02ef758a28afc08693f948 /ctdb/tests | |
parent | c6c81ea287924c2924aebc6dc0cdea1dc4322ae2 (diff) | |
download | samba-f4c2c77ff726dd7d28a7d8c3cd815c802a8a6cfa.tar.gz |
ctdb-tests: Improve test quality
Simplify code, use more modern commands, code improvements (shellcheck).
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tests')
-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 |