summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/INTEGRATION/simple/basics.002.tunables.sh
blob: 6f362c685b3c999a2b70cf2128b1e620837c1c02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash

# Verify the operation of "ctdb listvars", "ctdb getvar", "ctdb setvar"

. "${TEST_SCRIPTS_DIR}/integration.bash"

set -e

ctdb_test_init

try_command_on_node -v 0 "$CTDB listvars"

sanity_check_output \
    5 \
    '^[[:alpha:]][[:alnum:]]+[[:space:]]*=[[:space:]]*[[:digit:]]+$'

echo "Verifying all variable values using \"ctdb getvar\"..."

while read var x val ; do
    try_command_on_node 0 "$CTDB getvar $var"

    val2="${out#*= }"

    if [ "$val" != "$val2" ] ; then
	echo "MISMATCH on $var: $val != $val2"
	exit 1
    fi
done <"$outfile"

echo "GOOD: all tunables match"

var="RecoverTimeout"

try_command_on_node -v 0 $CTDB getvar $var

val="${out#*= }"

echo "Going to try incrementing it..."

incr=$(($val + 1))

try_command_on_node 0 $CTDB setvar $var $incr

echo "That seemed to work, let's check the value..."

try_command_on_node -v 0 $CTDB getvar $var

newval="${out#*= }"

if [ "$incr" != "$newval" ] ; then
    echo "Nope, that didn't work..."
    exit 1
fi

echo "Look's good!  Now verifying with \"ctdb listvars\""
try_command_on_node -v 0 "$CTDB listvars | grep '^$var'"

check="${out#*= }"

if [ "$incr" != "$check" ] ; then
    echo "Nope, that didn't work..."
    exit 1
fi

echo "Look's good!  Putting the old value back..."
cmd="$CTDB setvar $var $val"
try_command_on_node 0 $cmd