summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-09-12 13:34:51 +1000
committerAmitay Isaacs <amitay@samba.org>2014-09-23 08:06:12 +0200
commit4b8cfe4847477e3cfdb3f4dd7070226a6604bc38 (patch)
tree5e2b1a343c4bb453006a6c5c360856655a3caf8b
parent8a6445d02580aca37ef2f69964890cf3de2aeac4 (diff)
downloadsamba-4b8cfe4847477e3cfdb3f4dd7070226a6604bc38.tar.gz
samba-4b8cfe4847477e3cfdb3f4dd7070226a6604bc38.tar.xz
samba-4b8cfe4847477e3cfdb3f4dd7070226a6604bc38.zip
ctdb-tests: Simplify and rename wait_until_ips_are_on_nodeglob()
The glob functionality is unsed so simplify the code by removing it. Rename this function to wait_until_ips_are_on_node(). Update all calls. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
-rw-r--r--ctdb/tests/scripts/integration.bash24
-rwxr-xr-xctdb/tests/simple/16_ctdb_config_add_ip.sh2
-rwxr-xr-xctdb/tests/simple/23_ctdb_moveip.sh4
-rwxr-xr-xctdb/tests/simple/31_ctdb_disable.sh2
-rwxr-xr-xctdb/tests/simple/32_ctdb_enable.sh2
-rwxr-xr-xctdb/tests/simple/41_ctdb_stop.sh2
-rwxr-xr-xctdb/tests/simple/42_ctdb_continue.sh2
-rwxr-xr-xctdb/tests/simple/60_recoverd_missing_ip.sh4
8 files changed, 22 insertions, 20 deletions
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index dec60a2990..548b1e19c0 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -380,29 +380,31 @@ wait_until_node_has_status ()
}
# Useful for superficially testing IP failover.
-# IPs must be on nodes matching nodeglob.
-# If the first argument is '!' then the IPs must not be on nodes
-# matching nodeglob.
-ips_are_on_nodeglob ()
+# IPs must be on the given node.
+# If the first argument is '!' then the IPs must not be on the given node.
+ips_are_on_node ()
{
local negating=false
if [ "$1" = "!" ] ; then
negating=true ; shift
fi
- local nodeglob="$1" ; shift
+ local node="$1" ; shift
local ips="$*"
local out
all_ips_on_node 1
+ local check
for check in $ips ; do
+ local ip pnn
while read ip pnn ; do
if [ "$check" = "$ip" ] ; then
- case "$pnn" in
- ($nodeglob) if $negating ; then return 1 ; fi ;;
- (*) if ! $negating ; then return 1 ; fi ;;
- esac
+ if [ "$pnn" = "$node" ] ; then
+ if $negating ; then return 1 ; fi
+ else
+ if ! $negating ; then return 1 ; fi
+ fi
ips="${ips/${ip}}" # Remove from list
break
fi
@@ -418,11 +420,11 @@ ips_are_on_nodeglob ()
[ -z "$ips" ]
}
-wait_until_ips_are_on_nodeglob ()
+wait_until_ips_are_on_node ()
{
echo "Waiting for IPs to fail over..."
- wait_until 60 ips_are_on_nodeglob "$@"
+ wait_until 60 ips_are_on_node "$@"
}
node_has_some_ips ()
diff --git a/ctdb/tests/simple/16_ctdb_config_add_ip.sh b/ctdb/tests/simple/16_ctdb_config_add_ip.sh
index dc28130a19..d4301c86ee 100755
--- a/ctdb/tests/simple/16_ctdb_config_add_ip.sh
+++ b/ctdb/tests/simple/16_ctdb_config_add_ip.sh
@@ -114,7 +114,7 @@ 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 ${add_ip%/*} ; then
+if wait_until 60 ips_are_on_node $test_node ${add_ip%/*} ; then
echo "That worked!"
else
echo "BAD: IP didn't get added."
diff --git a/ctdb/tests/simple/23_ctdb_moveip.sh b/ctdb/tests/simple/23_ctdb_moveip.sh
index 7c09e58503..63ededfb74 100755
--- a/ctdb/tests/simple/23_ctdb_moveip.sh
+++ b/ctdb/tests/simple/23_ctdb_moveip.sh
@@ -86,14 +86,14 @@ try_command_on_node 0 $CTDB setvar NoIPFailback 1 -n all
echo "Attempting to move ${ip_to_move} from node ${test_node} to node ${to_node}."
try_command_on_node $test_node $CTDB moveip $ip_to_move $to_node
-if wait_until_ips_are_on_nodeglob "[!${test_node}]" $ip_to_move ; then
+if wait_until_ips_are_on_node '!' $test_node $ip_to_move ; then
echo "IP moved from ${test_node}."
else
echo "BAD: IP didn't move from ${test_node}."
exit 1
fi
-if wait_until_ips_are_on_nodeglob "$to_node" $ip_to_move ; then
+if wait_until_ips_are_on_node "$to_node" $ip_to_move ; then
echo "IP moved to ${to_node}."
else
echo "BAD: IP didn't move to ${to_node}."
diff --git a/ctdb/tests/simple/31_ctdb_disable.sh b/ctdb/tests/simple/31_ctdb_disable.sh
index d0214549a4..4331d26ce8 100755
--- a/ctdb/tests/simple/31_ctdb_disable.sh
+++ b/ctdb/tests/simple/31_ctdb_disable.sh
@@ -49,7 +49,7 @@ try_command_on_node 1 $CTDB disable -n $test_node
# Avoid a potential race condition...
wait_until_node_has_status $test_node disabled
-if wait_until_ips_are_on_nodeglob "[!${test_node}]" $test_node_ips ; then
+if wait_until_ips_are_on_node '!' $test_node $test_node_ips ; then
echo "All IPs moved."
else
echo "Some IPs didn't move."
diff --git a/ctdb/tests/simple/32_ctdb_enable.sh b/ctdb/tests/simple/32_ctdb_enable.sh
index 7cc3da3129..bf60d81da2 100755
--- a/ctdb/tests/simple/32_ctdb_enable.sh
+++ b/ctdb/tests/simple/32_ctdb_enable.sh
@@ -50,7 +50,7 @@ try_command_on_node 1 $CTDB disable -n $test_node
wait_until_node_has_status $test_node disabled
-if wait_until_ips_are_on_nodeglob "[!${test_node}]" $test_node_ips ; then
+if wait_until_ips_are_on_node '!' $test_node $test_node_ips ; then
echo "All IPs moved."
else
echo "Some IPs didn't move."
diff --git a/ctdb/tests/simple/41_ctdb_stop.sh b/ctdb/tests/simple/41_ctdb_stop.sh
index 1a45d8f0c9..dc1a5c3ac9 100755
--- a/ctdb/tests/simple/41_ctdb_stop.sh
+++ b/ctdb/tests/simple/41_ctdb_stop.sh
@@ -47,7 +47,7 @@ try_command_on_node 1 $CTDB stop -n $test_node
wait_until_node_has_status $test_node stopped
-if wait_until_ips_are_on_nodeglob "[!${test_node}]" $test_node_ips ; then
+if wait_until_ips_are_on_node '!' $test_node $test_node_ips ; then
echo "All IPs moved."
else
echo "Some IPs didn't move."
diff --git a/ctdb/tests/simple/42_ctdb_continue.sh b/ctdb/tests/simple/42_ctdb_continue.sh
index 381baf55f0..f8f301d596 100755
--- a/ctdb/tests/simple/42_ctdb_continue.sh
+++ b/ctdb/tests/simple/42_ctdb_continue.sh
@@ -49,7 +49,7 @@ try_command_on_node 1 $CTDB stop -n $test_node
wait_until_node_has_status $test_node stopped
-if wait_until_ips_are_on_nodeglob "[!${test_node}]" $test_node_ips ; then
+if wait_until_ips_are_on_node '!' $test_node $test_node_ips ; then
echo "All IPs moved."
else
echo "Some IPs didn't move."
diff --git a/ctdb/tests/simple/60_recoverd_missing_ip.sh b/ctdb/tests/simple/60_recoverd_missing_ip.sh
index 88e450227b..8ba05702a9 100755
--- a/ctdb/tests/simple/60_recoverd_missing_ip.sh
+++ b/ctdb/tests/simple/60_recoverd_missing_ip.sh
@@ -40,7 +40,7 @@ echo "$test_ip/$mask is on $iface"
echo "Deleting IP $test_ip from all nodes"
try_command_on_node -v $test_node $CTDB delip -n all $test_ip
-wait_until_ips_are_on_nodeglob '!' $test_node $test_ip
+wait_until_ips_are_on_node '!' $test_node $test_ip
try_command_on_node -v all $CTDB ip
@@ -93,7 +93,7 @@ try_command_on_node $test_node $CTDB clearlog recoverd
echo "Marking interface $iface up on node $test_node"
try_command_on_node $test_node $CTDB setifacelink $iface up
-wait_until_ips_are_on_nodeglob $test_node $test_ip
+wait_until_ips_are_on_node $test_node $test_ip
try_command_on_node -v $test_node $CTDB getlog recoverd