summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/scripts
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2012-07-02 14:06:35 +1000
committerAmitay Isaacs <amitay@gmail.com>2012-07-26 22:03:00 +1000
commit523be079ea82928b3772480842a75b7533a12d9d (patch)
treebdc00cb0e0f92f52247e69492584fadd6e7cd254 /ctdb/tests/scripts
parent959e37da7bbdfa47f7e4fd6e9b92dbac1f9dea58 (diff)
downloadsamba-523be079ea82928b3772480842a75b7533a12d9d.tar.gz
samba-523be079ea82928b3772480842a75b7533a12d9d.tar.xz
samba-523be079ea82928b3772480842a75b7533a12d9d.zip
tests: select_test_node_and_ips() should try to avoid failing
Sometimes "ctdb sync" doesn't do its job, so we end up with unassigned IPs. If $test_node isn't set then this is bad. However, try a few times to ensure it is set. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 2fd0157382b42aa5c5212b8e743c6f589edc6662)
Diffstat (limited to 'ctdb/tests/scripts')
-rw-r--r--ctdb/tests/scripts/integration.bash20
1 files changed, 19 insertions, 1 deletions
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index 5229184066..8b268b1aa0 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -234,7 +234,7 @@ all_ips_on_node()
try_command_on_node $node "$CTDB ip -Y -n all | cut -d ':' -f1-3 | sed -e '1d' -e 's@^:@@' -e 's@:@ @g'"
}
-select_test_node_and_ips ()
+_select_test_node_and_ips ()
{
all_ips_on_node 0
@@ -252,6 +252,24 @@ select_test_node_and_ips ()
echo "Selected node ${test_node} with IPs: ${test_node_ips}."
test_ip="${test_node_ips%% *}"
+
+ [ -n "$test_node" ] || return 1
+}
+
+select_test_node_and_ips ()
+{
+ local timeout=10
+ while ! _select_test_node_and_ips ; do
+ echo "Unable to find a test node with IPs assigned"
+ if [ $timeout -le 0 ] ; then
+ echo "BAD: Too many attempts"
+ return 1
+ fi
+ sleep_for 1
+ timeout=$(($timeout - 1))
+ done
+
+ return 0
}
#######################################