diff options
| author | Martin Schwenke <martin@meltin.net> | 2014-09-12 13:34:51 +1000 |
|---|---|---|
| committer | Amitay Isaacs <amitay@samba.org> | 2014-09-23 08:06:12 +0200 |
| commit | 4b8cfe4847477e3cfdb3f4dd7070226a6604bc38 (patch) | |
| tree | 5e2b1a343c4bb453006a6c5c360856655a3caf8b /ctdb/tests/scripts | |
| parent | 8a6445d02580aca37ef2f69964890cf3de2aeac4 (diff) | |
| download | samba-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>
Diffstat (limited to 'ctdb/tests/scripts')
| -rw-r--r-- | ctdb/tests/scripts/integration.bash | 24 |
1 files changed, 13 insertions, 11 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 () |
