tests: select_test_node_and_ips() should never select non-node -1
authorMartin Schwenke <martin@meltin.net>
Thu, 14 Jun 2012 09:36:04 +0000 (19:36 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Thu, 26 Jul 2012 12:03:00 +0000 (22:03 +1000)
Instead of selecting the 1st pnn found, select the 1st one that isn't -1.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit f02e501342112aab67aee95f253e29a670b29273)

ctdb/tests/scripts/integration.bash

index 70308de61862d3e0f34cd6ad9cea72e3858af7a9..e3301f283cf687a5c6e3d74e83abfcff625e4875 100644 (file)
@@ -238,14 +238,13 @@ select_test_node_and_ips ()
 {
     all_ips_on_node 0
 
-    # When selecting test_node we just want a node that has public
-    # IPs.  This will work and is economically semi-random.  :-)
-    local x
-    read x test_node <<<"$out"
-
+    test_node=""  # this matches no PNN
     test_node_ips=""
     local ip pnn
     while read ip pnn ; do
+       if [ -z "$test_node" -a "$pnn" != "-1" ] ; then
+           test_node="$pnn"
+       fi
        if [ "$pnn" = "$test_node" ] ; then
             test_node_ips="${test_node_ips}${test_node_ips:+ }${ip}"
        fi