summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2010-08-05 15:58:56 +1000
committerMartin Schwenke <martin@meltin.net>2010-08-05 15:58:56 +1000
commit77ad2be488c859795f721f87f04def8488dfbce5 (patch)
treeff5a0f9e32db5640bca8de9da8ef77c0ef42f6a6
parentb930c885b3cfc95355bc29af4e4f5e31890bd275 (diff)
Test suite: weaken ctdb continue/enable tests for non-deterministic IPs.
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> (This used to be ctdb commit e9b3f5b1b51d541a911a27eb4348b368f28d185e)
-rw-r--r--ctdb/tests/scripts/ctdb_test_functions.bash24
-rwxr-xr-xctdb/tests/simple/32_ctdb_enable.sh11
-rwxr-xr-xctdb/tests/simple/42_ctdb_continue.sh10
3 files changed, 32 insertions, 13 deletions
diff --git a/ctdb/tests/scripts/ctdb_test_functions.bash b/ctdb/tests/scripts/ctdb_test_functions.bash
index 4f05888d4a..42053c0486 100644
--- a/ctdb/tests/scripts/ctdb_test_functions.bash
+++ b/ctdb/tests/scripts/ctdb_test_functions.bash
@@ -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"
diff --git a/ctdb/tests/simple/32_ctdb_enable.sh b/ctdb/tests/simple/32_ctdb_enable.sh
index 4c1026e54b..d0698f8098 100755
--- a/ctdb/tests/simple/32_ctdb_enable.sh
+++ b/ctdb/tests/simple/32_ctdb_enable.sh
@@ -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
diff --git a/ctdb/tests/simple/42_ctdb_continue.sh b/ctdb/tests/simple/42_ctdb_continue.sh
index b472420ac8..fffcb9e433 100755
--- a/ctdb/tests/simple/42_ctdb_continue.sh
+++ b/ctdb/tests/simple/42_ctdb_continue.sh
@@ -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