Test suite: loosen the getmonmode test.
[sahlberg/ctdb.git] / tests / simple / 20_ctdb_getmonmode.sh
1 #!/bin/bash
2
3 test_info()
4 {
5     cat <<EOF
6 Verify 'ctdb getmonmode' works correctly.
7
8 This test doesn't actually verify that enabling and disabling
9 monitoring mode actually does that.  It trusts ctdb that the
10 monitoring mode is modified as requested.  21_ctdb_disablemonitor.sh
11 does some more useful checking.
12
13 Prerequisites:
14
15 * An active CTDB cluster with at least 2 active nodes.
16
17 Steps:
18
19 1. Verify that the status on all of the ctdb nodes is 'OK'.
20 2. Use 'ctdb getmodmode -n <node>' to get the current monitoring mode.
21 3. Verify that it looks sane.
22 4. Verify that the command prints the output in colon-separated format
23    when run with the '-Y' option.
24 5. Disable monitoring on the node using 'ctdb disablemonitor'.
25 6. Verify that it shows monitoring as 'disabled'.
26
27 Expected results:
28
29 * 'ctdb getmonmode' works as expected.
30 EOF
31 }
32
33 . ctdb_test_functions.bash
34
35 ctdb_test_init "$@"
36
37 set -e
38
39 cluster_is_healthy
40
41 # Reset configuration
42 ctdb_restart_when_done
43
44 test_node=1
45
46 try_command_on_node -v 0 $CTDB getmonmode -n $test_node
47
48 sanity_check_output \
49     1 \
50     '^Monitoring mode:(ACTIVE \(0\)|DISABLED \(1\))$' \
51     "$out"
52
53 try_command_on_node -v 0 $CTDB -Y getmonmode -n $test_node
54
55 sanity_check_output 2 '^(:mode:|:0:|:1:)$' "$out"
56
57 try_command_on_node -v 0 $CTDB disablemonitor -n $test_node
58
59 wait_until_node_has_status $test_node monoff