summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/scripts
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2010-08-13 17:01:54 +1000
committerMartin Schwenke <martin@meltin.net>2010-08-13 17:01:54 +1000
commit03aa9ee702540da9b44034cd34ecba7777dbbf27 (patch)
tree2efe0c1aa42857dc9a800bcea115395a6a72e48b /ctdb/tests/scripts
parenta9fb1e318b2d41da7f9eb777c6d5f821cf7fbaf6 (diff)
Test suite: strengthen function _cluster_is_healthy().
If there's a chance that "ctdb status -Y" can return 0 but print garbage then this function might return a false positive. So, we do 2 things: * Redirect stderr to >/dev/null rather than looking at it. This minimises the chance that we will see garbage. * Since we need at least 1 good line to decide the cluster is healthy, we sanity check each line to esnure it starts with :[0-9]. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit d4189c7c3fceaa833f9f0446a2b06af6fed714ec)
Diffstat (limited to 'ctdb/tests/scripts')
-rw-r--r--ctdb/tests/scripts/ctdb_test_functions.bash6
1 files changed, 4 insertions, 2 deletions
diff --git a/ctdb/tests/scripts/ctdb_test_functions.bash b/ctdb/tests/scripts/ctdb_test_functions.bash
index 40a9642afb..d2b069c95b 100644
--- a/ctdb/tests/scripts/ctdb_test_functions.bash
+++ b/ctdb/tests/scripts/ctdb_test_functions.bash
@@ -336,13 +336,15 @@ _cluster_is_healthy ()
{
local out x count line
- out=$($CTDB -Y status 2>&1) || return 1
+ out=$($CTDB -Y status 2>/dev/null) || return 1
{
read x
count=0
while read line ; do
- count=$(($count + 1))
+ # We need to see valid lines if we're going to be healthy.
+ [ "${line#:[0-9]}" != "$line" ] && count=$(($count + 1))
+ # A line indicating a node is unhealthy causes failure.
[ "${line##:*:*:*1:}" != "$line" ] && return 1
done
[ $count -gt 0 ] && return $?