ctdb-tests: Don't used daemons_start()/daemons_stop() directly in tests
[samba.git] / ctdb / tests / simple / 19_ip_takeover_noop.sh
1 #!/bin/bash
2
3 test_info()
4 {
5     cat <<EOF
6 Check that CTDB operates correctly if:
7
8 * failover is disabled; or
9 * there are 0 public IPs configured
10
11 This test only does anything with local daemons.  On a real cluster it
12 has no way of updating configuration.
13 EOF
14 }
15
16 . "${TEST_SCRIPTS_DIR}/integration.bash"
17
18 ctdb_test_init "$@"
19
20 set -e
21
22 cluster_is_healthy
23
24 if [ -z "$TEST_LOCAL_DAEMONS" ] ; then
25         echo "SKIPPING this test - only runs against local daemons"
26         exit 0
27 fi
28
29 # Reset configuration
30 ctdb_restart_when_done
31
32 select_test_node_and_ips
33
34 ctdb_stop_all
35
36 echo "Starting CTDB with failover disabled..."
37 setup_ctdb --disable-failover
38 ctdb_start_all
39
40 wait_until_ready
41
42 echo "Getting IP allocation..."
43 try_command_on_node -v any "$CTDB ip all | tail -n +2"
44
45 while read ip pnn ; do
46         if [ "$pnn" != "-1" ] ; then
47                 die "BAD: IP address ${ip} is assigned to node ${pnn}"
48         fi
49 done <<EOF
50 $out
51 EOF
52
53 echo "GOOD: All IP addresses are unassigned"
54
55 echo "----------------------------------------"
56 ctdb_stop_all
57
58 echo "Starting CTDB with an empty public addresses configuration..."
59 setup_ctdb --no-public-addresses
60 ctdb_start_all
61
62 wait_until_ready
63
64 echo "Trying explicit ipreallocate..."
65 try_command_on_node any $CTDB ipreallocate
66
67 echo "Good, that seems to work!"
68 echo