winbindd_cm: Pass cm_open_connection the need_rw_dc flag
[Samba.git] / ctdb / tests / complex / 32_cifs_tickle.sh
blobda369b9f5f72704501fdb92e4c1d22c2d07a6234
1 #!/bin/bash
3 test_info()
5 cat <<EOF
6 Verify that CIFS connections are monitored and that CIFS tickles are sent.
8 We create a connection to the CIFS server on a node and confirm that
9 this connection is registered by CTDB. Then disable the relevant CIFS
10 server node and ensure that the takeover node sends an appropriate
11 reset packet.
13 Prerequisites:
15 * An active CTDB cluster with at least 2 nodes with public addresses.
17 * Test must be run on a real or virtual cluster rather than against
18 local daemons.
20 * Test must not be run from a cluster node.
22 * Clustered Samba must be listening on TCP port 445.
24 Expected results:
26 * CTDB should correctly record the connection and the takeover node
27 should send a reset packet.
28 EOF
31 . "${TEST_SCRIPTS_DIR}/integration.bash"
33 set -e
35 ctdb_test_init "$@"
37 ctdb_test_check_real_cluster
39 cluster_is_healthy
41 # Reset configuration
42 ctdb_restart_when_done
44 # We need this for later, so we know how long to sleep.
45 try_command_on_node 0 $CTDB getvar MonitorInterval
46 monitor_interval="${out#*= }"
47 #echo "Monitor interval on node $test_node is $monitor_interval seconds."
49 select_test_node_and_ips
51 test_port=445
53 echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."
55 nc -d -w $(($monitor_interval * 4)) $test_ip $test_port &
56 nc_pid=$!
57 ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"
59 wait_until_get_src_socket "tcp" "${test_ip}:${test_port}" $nc_pid "nc"
60 src_socket="$out"
61 echo "Source socket is $src_socket"
63 # This should happen as soon as connection is up... but unless we wait
64 # we sometimes beat the registration.
65 echo "Checking if CIFS connection is tracked by CTDB on test node..."
66 wait_until 10 check_tickles $test_node $test_ip $test_port $src_socket
67 echo "$out"
69 if [ "${out/SRC: ${src_socket} /}" != "$out" ] ; then
70 echo "GOOD: CIFS connection tracked OK by CTDB."
71 else
72 echo "BAD: Socket not tracked by CTDB."
73 testfailures=1
76 # This is almost immediate. However, it is sent between nodes
77 # asynchonously, so it is worth checking...
78 echo "Wait until CIFS connection is tracked by CTDB on all nodes..."
79 try_command_on_node $test_node "$CTDB listnodes | wc -l"
80 numnodes="$out"
81 wait_until 5 \
82 check_tickles_all $numnodes $test_ip $test_port $src_socket
83 tcptickle_sniff_start $src_socket "${test_ip}:${test_port}"
85 echo "Disabling node $test_node"
86 try_command_on_node 1 $CTDB disable -n $test_node
87 wait_until_node_has_status $test_node disabled
89 tcptickle_sniff_wait_show