summaryrefslogtreecommitdiff
path: root/ctdb/tests/INTEGRATION/failover
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2020-07-22 14:42:53 +1000
committerMartin Schwenke <martins@samba.org>2020-07-22 05:07:45 +0000
commit635d5cfa31a8e890f4ae43b465b26a416d96d2bc (patch)
tree1b40d4dd73b624e77f300273aa3d6f652e8ff9ea /ctdb/tests/INTEGRATION/failover
parentc83ece42e5b2e12e9a1305476d89522742201ba9 (diff)
downloadsamba-635d5cfa31a8e890f4ae43b465b26a416d96d2bc.tar.gz
Revert "ctdb-tests: Improve test portability"
Fix missing Reviewed-by: tag. This reverts commit 1079d6e3ae5805ef65a3628edf0a3ac2cd7fac1c. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tests/INTEGRATION/failover')
-rwxr-xr-xctdb/tests/INTEGRATION/failover/pubips.040.NoIPTakeover.sh43
1 files changed, 14 insertions, 29 deletions
diff --git a/ctdb/tests/INTEGRATION/failover/pubips.040.NoIPTakeover.sh b/ctdb/tests/INTEGRATION/failover/pubips.040.NoIPTakeover.sh
index 058d7febf5f..a39e48d0883 100755
--- a/ctdb/tests/INTEGRATION/failover/pubips.040.NoIPTakeover.sh
+++ b/ctdb/tests/INTEGRATION/failover/pubips.040.NoIPTakeover.sh
@@ -22,26 +22,9 @@ echo "Wait until the ips are reallocated"
sleep_for 30
try_command_on_node 0 "$CTDB ipreallocate"
-# sets: num
-count_ips_on_node ()
-{
- local node="$1"
-
- ctdb_onnode "$node" ip
- # outfile is set by ctdb_onnode() above
- # shellcheck disable=SC2154,SC2126
- # * || true is needed to avoid command failure when there are no matches
- # * Using "wc -l | tr -d '[:space:]'" is our standard
- # pattern... and "grep -c" requires handling of special case
- # for no match
- num=$(grep -v 'Public' "$outfile" | \
- grep " ${node}\$" | \
- wc -l | \
- tr -d '[:space:]')
- echo "Number of addresses on node ${node}: ${num}"
-}
+num=`try_command_on_node -v 1 "$CTDB ip" | grep -v Public | egrep " 1$" | wc -l`
+echo "Number of addresses on node 1 : $num"
-count_ips_on_node 1
echo "Turning on NoIPTakeover on all nodes"
try_command_on_node all "$CTDB setvar NoIPTakeover 1"
@@ -50,11 +33,12 @@ try_command_on_node 1 "$CTDB ipreallocate"
echo Disable node 1
try_command_on_node 1 "$CTDB disable"
try_command_on_node 1 "$CTDB ipreallocate"
-
-count_ips_on_node 1
-if [ "$num" != "0" ] ; then
- test_fail "BAD: node 1 still hosts IP addresses"
-fi
+num=`try_command_on_node -v 1 "$CTDB ip" | grep -v Public | egrep " 1$" | wc -l`
+echo "Number of addresses on node 1 : $num"
+[ "$num" != "0" ] && {
+ echo "BAD: node 1 still hosts ip addresses"
+ exit 1
+}
echo "Enable node 1 again"
@@ -62,11 +46,12 @@ try_command_on_node 1 "$CTDB enable"
sleep_for 30
try_command_on_node 1 "$CTDB ipreallocate"
try_command_on_node 1 "$CTDB ipreallocate"
-
-count_ips_on_node 1
-if [ "$num" != "0" ] ; then
- test_fail "BAD: node 1 took over IP addresses"
-fi
+num=`try_command_on_node -v 1 "$CTDB ip" | grep -v Public | egrep " 1$" | wc -l`
+echo "Number of addresses on node 1 : $num"
+[ "$num" != "0" ] && {
+ echo "BAD: node took over ip addresses"
+ exit 1
+}
echo "OK. ip addresses were not taken over"