replmd: Use replmd_set_la_val() when adding new links
[Samba.git] / ctdb / tests / complex / 37_nfs_reset_server.sh
blobd6dd0f03b1ff7e14536a29159e302fd63eac512a
1 #!/bin/bash
3 test_info()
5 cat <<EOF
6 Verify that the server end of an NFS connection is correctly reset
8 Prerequisites:
10 * An active CTDB cluster with at least 2 nodes with public addresses.
12 * Test must be run on a real or virtual cluster rather than against
13 local daemons.
15 * Test must not be run from a cluster node.
17 * Cluster nodes must be listening on the NFS TCP port (2049).
19 Expected results:
21 * CTDB should correctly record the connection and the releasing node
22 should reset the server end of the connection.
23 EOF
26 . "${TEST_SCRIPTS_DIR}/integration.bash"
28 set -e
30 ctdb_test_init "$@"
32 ctdb_test_check_real_cluster
34 cluster_is_healthy
36 # Reset configuration
37 ctdb_restart_when_done
39 # We need this for later, so we know how long to sleep.
40 try_command_on_node 0 $CTDB getvar MonitorInterval
41 monitor_interval="${out#*= }"
43 select_test_node_and_ips
45 test_port=2049
47 echo "Set NoIPTakeover=1 on all nodes"
48 try_command_on_node all $CTDB setvar NoIPTakeover 1
50 echo "Give the recovery daemon some time to reload tunables"
51 sleep_for 5
53 echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with nc..."
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 echo "Wait until NFS connection is tracked by CTDB on test node ..."
64 wait_until $((monitor_interval * 2)) \
65 check_tickles $test_node $test_ip $test_port $src_socket
66 echo "$out"
68 # It would be nice if ss consistently used local/peer instead of src/dst
69 ss_filter="src ${test_ip}:${test_port} dst ${src_socket}"
71 try_command_on_node $test_node \
72 "ss -tn state established '${ss_filter}' | tail -n +2"
73 if [ -z "$out" ] ; then
74 echo "BAD: ss did not list the socket"
75 exit 1
77 echo "GOOD: ss lists the socket:"
78 echo "$out"
80 echo "Disabling node $test_node"
81 try_command_on_node 1 $CTDB disable -n $test_node
82 wait_until_node_has_status $test_node disabled
84 try_command_on_node $test_node \
85 "ss -tn state established '${ss_filter}' | tail -n +2"
86 if [ -n "$out" ] ; then
87 echo "BAD: ss listed the socket after failover"
88 exit 1
90 echo "GOOD: ss no longer lists the socket"