748e329bed2ed8057e6658912e5fbe9ce7cf5f77
[vlendec/samba-autobuild/.git] / ctdb / tests / simple / 03_ctdb_getvar.sh
1 #!/bin/bash
2
3 test_info()
4 {
5     cat <<EOF
6 Verify that 'ctdb getvar' works correctly.
7
8 Expands on the steps below as it actually checks the values of all
9 variables listed by 'ctdb listvars'.
10
11 Prerequisites:
12
13 * An active CTDB cluster with at least 2 active nodes.
14
15 Steps:
16
17 1. Verify that the status on all of the ctdb nodes is 'OK'.
18 2. Run 'ctdb getvars <varname>' with a valid variable name (possibly
19    obtained via 'ctdb listvars'.
20 3. Verify that the command displays the correct value of the variable
21    (corroborate with the value shown by 'ctdb listvars'.
22
23 Expected results:
24
25 * 'ctdb getvar' shows the correct value of the variable.
26 EOF
27 }
28
29 . ctdb_test_functions.bash
30
31 ctdb_test_init "$@"
32
33 set -e
34
35 cluster_is_healthy
36
37 try_command_on_node -v 0 "$CTDB listvars"
38
39 echo "Veryifying all variable values using \"ctdb getvar\"..."
40
41 echo "$out" |
42 while read var x val ; do
43     try_command_on_node 0 "$CTDB getvar $var"
44
45     val2="${out#*= }"
46
47     if [ "$val" != "$val2" ] ; then
48         echo "MISMATCH on $var: $val != $val2"
49         exit 1
50     fi
51 done