summaryrefslogtreecommitdiff
path: root/ctdb/tests
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2015-05-12 14:11:59 +1000
committerAmitay Isaacs <amitay@samba.org>2015-05-13 06:42:13 +0200
commit6ad263ff94ed77bb1a7fc7baf8c74dfa12d761de (patch)
tree82aeac6fb078e9eec65a770b17ab24bb653b3502 /ctdb/tests
parent3b25face87b01c3013cf40f4b54be0c58aff5b4b (diff)
downloadsamba-6ad263ff94ed77bb1a7fc7baf8c74dfa12d761de.tar.gz
ctdb-tests: Add tickle test for external public address handling
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tests')
-rwxr-xr-xctdb/tests/complex/35_cifs_external_tickle.sh102
1 files changed, 102 insertions, 0 deletions
diff --git a/ctdb/tests/complex/35_cifs_external_tickle.sh b/ctdb/tests/complex/35_cifs_external_tickle.sh
new file mode 100755
index 00000000000..fabe81b5c0a
--- /dev/null
+++ b/ctdb/tests/complex/35_cifs_external_tickle.sh
@@ -0,0 +1,102 @@
+#!/bin/bash
+
+test_info()
+{
+ cat <<EOF
+For external IP address management, verify that CIFS tickles are sent.
+
+Prerequisites:
+
+* An active CTDB cluster with at least 2 nodes with public addresses.
+
+* Test must be run on a real or virtual cluster rather than against
+ local daemons.
+
+* Test must not be run from a cluster node.
+
+* Clustered Samba must be listening on TCP port 445.
+EOF
+}
+
+. "${TEST_SCRIPTS_DIR}/integration.bash"
+
+set -e
+
+ctdb_test_init "$@"
+
+ctdb_test_check_real_cluster
+
+cluster_is_healthy
+
+# Reset configuration
+ctdb_restart_when_done
+
+select_test_node_and_ips
+
+# Select a different node to move the IP address to
+to_node=""
+while read x to_node ; do
+ if [ "$to_node" != "$test_node" ] ; then
+ break
+ fi
+done <<<"$out"
+if [ -z "$to_node" ] ; then
+ die "BAD: Unable to find a target node different to ${to_node}"
+fi
+
+echo "Get mask and interface for ${test_ip}"
+get_test_ip_mask_and_iface
+
+echo "Set DisableIPFailover=1 on all nodes"
+try_command_on_node all $CTDB setvar DisableIPFailover 1
+
+echo "Give the recovery daemon some time to reload tunables"
+sleep_for 5
+
+my_exit_hook ()
+{
+ onnode -q all $CTDB enablescript "10.interface"
+ onnode -q all $CTDB disablescript "10.external"
+}
+ctdb_test_exit_hook_add my_exit_hook
+
+echo "Disable 10.interface on all nodes"
+try_command_on_node all $CTDB disablescript 10.interface
+echo "Enable 10.external on all nodes"
+try_command_on_node all $CTDB enablescript 10.external
+
+test_port=445
+
+echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."
+
+nc -d -w 60 $test_ip $test_port &
+nc_pid=$!
+ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"
+
+wait_until_get_src_socket "tcp" "${test_ip}:${test_port}" $nc_pid "nc"
+src_socket="$out"
+echo "Source socket is $src_socket"
+
+# This should happen as soon as connection is up... but unless we wait
+# we sometimes beat the registration.
+echo "Checking if CIFS connection is tracked by CTDB..."
+wait_until 10 check_tickles $test_node $test_ip $test_port $src_socket
+echo "$out"
+
+if [ "${out/SRC: ${src_socket} /}" != "$out" ] ; then
+ echo "GOOD: CIFS connection tracked OK by CTDB."
+else
+ echo "BAD: Socket not tracked by CTDB."
+ testfailures=1
+fi
+
+tcptickle_sniff_start $src_socket "${test_ip}:${test_port}"
+
+echo "Moving $test_ip from $test_node to $to_node"
+try_command_on_node $test_node ip addr del "${test_ip}/${mask}" dev "$iface"
+try_command_on_node $to_node ip addr add "${test_ip}/${mask}" dev "$iface"
+try_command_on_node $to_node ctdb moveip "$test_ip" "$to_node"
+
+wait_until_ips_are_on_node "$to_node" "$test_ip"
+
+tcptickle_sniff_wait_show