summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/scripts
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2012-10-12 16:12:38 +1100
committerAmitay Isaacs <amitay@gmail.com>2013-01-08 13:27:10 +1100
commitef7329a415dc4127950e0bf428ed4b84117a04b7 (patch)
tree167f5a64c8ffd4acfc32bb73ea84f092f937f7d9 /ctdb/tests/scripts
parente2306dd82b35dae4ab957519602f32549c8bda46 (diff)
downloadsamba-ef7329a415dc4127950e0bf428ed4b84117a04b7.tar.gz
samba-ef7329a415dc4127950e0bf428ed4b84117a04b7.tar.xz
samba-ef7329a415dc4127950e0bf428ed4b84117a04b7.zip
tests/simple: Add test to check recovery daemon IP verification
Also update ips_are_on_nodeglob() to handle negation. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 13a5944f8a27d43006acfffba76958693cae7702)
Diffstat (limited to 'ctdb/tests/scripts')
-rw-r--r--ctdb/tests/scripts/integration.bash24
1 files changed, 18 insertions, 6 deletions
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index 07e764ea201..2e5fb37d7a3 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -438,8 +438,14 @@ 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 ()
{
+ local negating=false
+ if [ "$1" = "!" ] ; then
+ negating=true ; shift
+ fi
local nodeglob="$1" ; shift
local ips="$*"
@@ -447,17 +453,23 @@ ips_are_on_nodeglob ()
all_ips_on_node 1
- while read ip pnn ; do
- for check in $ips ; do
+ for check in $ips ; do
+ while read ip pnn ; do
if [ "$check" = "$ip" ] ; then
case "$pnn" in
- ($nodeglob) : ;;
- (*) return 1 ;;
+ ($nodeglob) if $negating ; then return 1 ; fi ;;
+ (*) if ! $negating ; then return 1 ; fi ;;
esac
ips="${ips/${ip}}" # Remove from list
+ break
fi
- done
- done <<<"$out" # bashism to avoid problem setting variable in pipeline.
+ # If we're negating and we didn't see the address then it
+ # isn't hosted by anyone!
+ if $negating ; then
+ ips="${ips/${check}}"
+ fi
+ done <<<"$out" # bashism to avoid problem setting variable in pipeline.
+ done
ips="${ips// }" # Remove any spaces.
[ -z "$ips" ]