Test suite - try to make addip test more reliable and add some debugging.
authorMartin Schwenke <martin@meltin.net>
Wed, 4 Aug 2010 03:16:06 +0000 (13:16 +1000)
committerMartin Schwenke <martin@meltin.net>
Wed, 4 Aug 2010 03:16:06 +0000 (13:16 +1000)
This test is failing in some situations.  The "ctdb addip" command
works but the IP never appears in the "ctdb ip" output.

Try restricting the last octet to be between 101-199.  At the moment
addresses like 10.0.2.1 are being chosen and these are often the
address of the host machine in autocluster configurations... so might
cause weirdness.

Also add some debugging if checking for the IP address times out.

Signed-off-by: Martin Schwenke <martin@meltin.net>
tests/simple/16_ctdb_config_add_ip.sh

index 79849f2c5b6a81890a1ce7b6fb0157897b9fc116..5505e9938798d61ac753f4cd207d0a901a3a937a 100755 (executable)
@@ -73,7 +73,7 @@ add_ip=""
 # loop through the possible IP addreses.
 for i in $test_node_ips ; do
     prefix="${i%.*}"
-    for j in $(seq 1 254) ; do
+    for j in $(seq 101 199) ; do
        try="${prefix}.${j}"
        # Try to make sure it isn't used anywhere!
 
@@ -102,15 +102,19 @@ for i in $test_node_ips ; do
     done
 done
 
-if [ -n "$add_ip" ] ; then
-    echo "Adding IP: ${add_ip/:/ on interface }"
-    try_command_on_node $test_node $CTDB addip ${add_ip/:/ }
+if [ -z "$add_ip" ] ; then
+    echo "BAD: Unable to find IP address to add."
+    exit 1
+fi
 
-    echo "Waiting for IP to be added..."
-    wait_until 60 ips_are_on_nodeglob $test_node $test_node_ips ${add_ip%/*}
+echo "Adding IP: ${add_ip/:/ on interface }"
+try_command_on_node $test_node $CTDB addip ${add_ip/:/ }
 
+echo "Waiting for IP to be added..."
+if wait_until 60 ips_are_on_nodeglob $test_node $test_node_ips ${add_ip%/*} ; then
     echo "That worked!"
 else
-    echo "BAD: Unable to find IP address to add."
-    testfailures=1
+    echo "BAD: IP didn't get added."
+    try_command_on_node $test_node ctdb ip -n all
+    exit 1
 fi