summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2019-07-29 16:43:09 +1000
committerKarolin Seeger <kseeger@samba.org>2019-09-03 12:05:39 +0000
commit31066fde8c51c330deede0ba20d806aff81be886 (patch)
treecb471c50320a70a80b52bd13e2c52ee9302ec154 /ctdb
parentc3f2c55320d237d1ab7dc877629be259e4955d4d (diff)
downloadsamba-31066fde8c51c330deede0ba20d806aff81be886.tar.gz
ctdb-tests: Handle special cases first and return
All the other cases involve matching bits. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit bff1a3a548a2cace997b767d78bb824438664cb7)
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/tests/scripts/integration.bash59
1 files changed, 28 insertions, 31 deletions
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index 712932d7d4b..c1f57c81eb0 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -318,6 +318,19 @@ node_has_status ()
local pnn="$1"
local status="$2"
+ case "$status" in
+ recovered)
+ ! $CTDB status -n "$pnn" | \
+ grep -Eq '^Recovery mode:RECOVERY \(1\)$'
+ return
+ ;;
+ notlmaster)
+ ! $CTDB status -n "$pnn" | \
+ grep -Eq "^hash:.* lmaster:${pnn}\$"
+ return
+ ;;
+ esac
+
local bits
case "$status" in
unhealthy) bits="?|?|?|1|*" ;;
@@ -330,42 +343,26 @@ node_has_status ()
enabled) bits="?|?|0|*" ;;
stopped) bits="?|?|?|?|1|*" ;;
notstopped) bits="?|?|?|?|0|*" ;;
- recovered)
- ! $CTDB status -n "$pnn" | \
- grep -Eq '^Recovery mode:RECOVERY \(1\)$'
- return
- ;;
- notlmaster)
- ! $CTDB status -n "$pnn" | \
- grep -Eq "^hash:.* lmaster:${pnn}\$"
- return
- ;;
*)
echo "node_has_status: unknown status \"$status\""
return 1
esac
-
- if [ -n "$bits" ] ; then
- local out x line
-
- out=$($CTDB -X status 2>&1) || return 1
-
- {
- read x
- while read line ; do
- # This needs to be done in 2 steps to
- # avoid false matches.
- local line_bits="${line#|${pnn}|*|}"
- [ "$line_bits" = "$line" ] && continue
- [ "${line_bits#${bits}}" != "$line_bits" ] && \
- return 0
- done
- return 1
- } <<<"$out" # Yay bash!
- else
- echo 'node_has_status: unknown mode, $bits not set'
+ local out x line
+
+ out=$($CTDB -X status 2>&1) || return 1
+
+ {
+ read x
+ while read line ; do
+ # This needs to be done in 2 steps to
+ # avoid false matches.
+ local line_bits="${line#|${pnn}|*|}"
+ [ "$line_bits" = "$line" ] && continue
+ [ "${line_bits#${bits}}" != "$line_bits" ] && \
+ return 0
+ done
return 1
- fi
+ } <<<"$out" # Yay bash!
}
wait_until_node_has_status ()