replmd: Use replmd_set_la_val() when adding new links
[Samba.git] / ctdb / tests / complex / 45_failover_nfs_kill.sh
blobaada3711d11a8aabd096a13572432b398c098a53
1 #!/bin/bash
3 test_info()
5 cat <<EOF
6 Verify that a mounted NFS share is still operational after failover.
8 We mount an NFS share from a node, write a file via NFS and then
9 confirm that we can correctly read the file after a failover.
11 Prerequisites:
13 * An active CTDB cluster with at least 2 nodes with public addresses.
15 * Test must be run on a real or virtual cluster rather than against
16 local daemons.
18 * Test must not be run from a cluster node.
20 Steps:
22 1. Verify that the cluster is healthy.
23 2. Select a public address and its corresponding node.
24 3. Select the 1st NFS share exported on the node.
25 4. Mount the selected NFS share.
26 5. Create a file in the NFS mount and calculate its checksum.
27 6. Kill CTDB on the selected node.
28 7. Read the file and calculate its checksum.
29 8. Compare the checksums.
31 Expected results:
33 * When a node is disabled the public address fails over and it is
34 possible to correctly read a file over NFS. The checksums should be
35 the same before and after.
36 EOF
39 . "${TEST_SCRIPTS_DIR}/integration.bash"
41 set -e
43 ctdb_test_init "$@"
45 ctdb_test_check_real_cluster
47 cluster_is_healthy
49 # Reset configuration
50 ctdb_restart_when_done
52 nfs_test_setup
54 echo "Create file containing random data..."
55 dd if=/dev/urandom of=$nfs_local_file bs=1k count=1
56 original_sum=$(sum $nfs_local_file)
57 [ $? -eq 0 ]
59 gratarp_sniff_start
61 echo "Killing node $test_node"
62 try_command_on_node $test_node $CTDB getpid
63 pid=${out#*:}
64 # We need to be nasty to make that the node being failed out doesn't
65 # get a chance to send any tickles or doing anything else clever. IPs
66 # also need to be dropped because we're simulating a dead node rather
67 # than a CTDB failure. To properly handle a CTDB failure we would
68 # need a watchdog to drop the IPs when CTDB disappears.
69 try_command_on_node -v $test_node "kill -9 $pid ; $CTDB_TEST_WRAPPER drop_ips ${test_node_ips}"
70 wait_until_node_has_status $test_node disconnected
72 gratarp_sniff_wait_show
74 new_sum=$(sum $nfs_local_file)
75 [ $? -eq 0 ]
77 if [ "$original_md5" = "$new_md5" ] ; then
78 echo "GOOD: file contents unchanged after failover"
79 else
80 echo "BAD: file contents are different after failover"
81 testfailures=1