ctdb-tests: Simplify a test
authorMartin Schwenke <martin@meltin.net>
Mon, 26 Feb 2018 19:40:59 +0000 (06:40 +1100)
committerAmitay Isaacs <amitay@samba.org>
Mon, 30 Apr 2018 09:41:22 +0000 (11:41 +0200)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/simple/20_delip_iface_gc.sh

index 8ad001fb460a3447edefbcb3215e3abccb4ff030..e73eed20cc00f1d3a576f60bd76dd4056e46c27c 100755 (executable)
@@ -18,14 +18,12 @@ cluster_is_healthy
 # Reset configuration
 ctdb_restart_when_done
 
-echo "Getting public IPs information..."
-try_command_on_node -v any "$CTDB ip -v all -X | tail -n +2"
-ip_info="$out"
-
-# Select the first node and find out its interfaces
-test_node=$(awk -F'|' 'NR == 1 { print $3}' <<<"$ip_info")
-ifaces=$(awk -F'|' -v tn=$test_node '$3 == tn { print $6 }' <<<"$ip_info" | sed 's@, @ @g' | xargs -n 1 | sort -u)
-echo "Selected test node ${test_node} with interfaces: ${ifaces}"
+select_test_node_and_ips
+
+# Find interfaces on test node
+try_command_on_node $test_node "$CTDB ifaces -X"
+ifaces=$(awk -F'|' 'NR > 1 { print $2 }' <<<"$out")
+echo "Node ${test_node} has interfaces: ${ifaces}"
 
 # Delete all IPs on each interface...  deleting IPs from one interface
 # can cause other interfaces to disappear, so we need to be careful...