Test suite: weaken ctdb continue/enable tests for non-deterministic IPs.
authorMartin Schwenke <martin@meltin.net>
Thu, 5 Aug 2010 05:58:56 +0000 (15:58 +1000)
committerMartin Schwenke <martin@meltin.net>
Thu, 5 Aug 2010 05:58:56 +0000 (15:58 +1000)
These tests currently wait for the old IPs to fail back to the test
node.  This isn't guaranteed with DeterministicIPs disabled.

This changes those tests to wait until the test node gets at least 1
IP assigned.

Signed-off-by: Martin Schwenke <martin@meltin.net>
tests/scripts/ctdb_test_functions.bash
tests/simple/32_ctdb_enable.sh
tests/simple/42_ctdb_continue.sh

index 4f05888d4a7dd7ec1aa1e3d5e34ef320585dd573..42053c0486a740ee80d44f42aaa4ac573618b25d 100644 (file)
@@ -482,6 +482,30 @@ wait_until_ips_are_on_nodeglob ()
     wait_until 60 ips_are_on_nodeglob "$@"
 }
 
+node_has_some_ips ()
+{
+    local node="$1"
+
+    local out
+
+    all_ips_on_node 1
+
+    while read ip pnn ; do
+       if [ "$node" = "$pnn" ] ; then
+           return 0
+       fi
+    done <<<"$out" # bashism to avoid problem setting variable in pipeline.
+
+    return 1
+}
+
+wait_until_node_has_some_ips ()
+{
+    echo "Waiting for node to have some IPs..."
+
+    wait_until 60 node_has_some_ips "$@"
+}
+
 get_src_socket ()
 {
     local proto="$1"
index 4c1026e54b3ed45970808c4246bca68b9b898589..d0698f8098bf9d25cd59ba664011f1e4d7bf35a7 100755 (executable)
@@ -23,8 +23,7 @@ Steps:
    failed over to other nodes.
 5. Enable the disabled node using 'ctdb enable -n '<node>'.
 6. Verify that the status changes back to 'OK'.
-7. Verify that the public IP addreses served by the disabled node are
-   failed back to the node.
+7. Verify that some public IP addreses are failed back to the node.
 
 
 Expected results:
@@ -63,11 +62,9 @@ try_command_on_node 1 $CTDB enable -n $test_node
 
 wait_until_node_has_status $test_node enabled
 
-# BUG: this is only guaranteed if DeterministicIPs is 1 and
-#      NoIPFailback is 0.
-if wait_until_ips_are_on_nodeglob "$test_node" $test_node_ips ; then
-    echo "All IPs moved."
+if wait_until_node_has_some_ips "$test_node" ; then
+    echo "OK."
 else
-    echo "Some IPs didn't move."
+    echo "No IPs moved to node $test_node."
     testfailures=1
 fi
index b472420ac8ad21595d87182a4be9601f629f93d4..fffcb9e4332154e7fadc9f2d1d01e0a4e36e9c92 100755 (executable)
@@ -23,7 +23,7 @@ Steps:
    the node are failed over to one of the other nodes.
 5. Use 'ctdb continue' to bring the node back online.
 6. Verify that the status of the node changes back to 'OK' and that
-   the public IP addresses move back to the node.
+   some public IP addresses move back to the node.
 
 Expected results:
 
@@ -61,11 +61,9 @@ try_command_on_node 1 $CTDB continue -n $test_node
 
 wait_until_node_has_status $test_node notstopped
 
-# BUG: this is only guaranteed if DeterministicIPs is 1 and
-#      NoIPFailback is 0.
-if wait_until_ips_are_on_nodeglob "$test_node" $ips ; then
-    echo "All IPs moved."
+if wait_until_no de_has_some_ips "$test_node" ; then
+    echo "OK."
 else
-    echo "Some IPs didn't move."
+    echo "No IPs moved to node $test_node."
     testfailures=1
 fi