1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-26 01:49:31 +03:00

ctdb-tests: Rationalise tunable simple tests

These 3 tests duplicate various checks and can easily be handled as a
single test.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke
2018-10-08 12:05:42 +11:00
committed by Amitay Isaacs
parent ba86eacb66
commit 43c26e1e64
3 changed files with 24 additions and 117 deletions

View File

@ -1,41 +0,0 @@
#!/bin/bash
test_info()
{
cat <<EOF
Verify that 'ctdb listvars' shows a list of all tunable variables.
This test simply checks that at least 5 sane looking lines are
printed. It does not check that the list is complete or that the
values are sane.
Prerequisites:
* An active CTDB cluster with at least 2 active nodes.
Steps:
1. Verify that the status on all of the ctdb nodes is 'OK'.
2. Run 'ctdb listvars' and verify that it shows a list of tunable
variables and their current values.
Expected results:
* 'ctdb listvars' works as expected.
EOF
}
. "${TEST_SCRIPTS_DIR}/integration.bash"
ctdb_test_init "$@"
set -e
cluster_is_healthy
try_command_on_node -v 0 "$CTDB listvars"
sanity_check_output \
5 \
'^[[:alpha:]][[:alnum:]]+[[:space:]]*=[[:space:]]*[[:digit:]]+$' \
"$out"

View File

@ -3,30 +3,7 @@
test_info()
{
cat <<EOF
Verify that 'ctdb setvar' works correctly.
Doesn't strictly follow the procedure outlines below, since it doesn't
pick a variable from the output of 'ctdb listvars'. However, it
verifies the value with 'ctdb getvar' in addition to 'ctdb listvars'.
Prerequisites:
* An active CTDB cluster with at least 2 active nodes.
Steps:
1. Verify that the status on all of the ctdb nodes is 'OK'.
2. Get a list of all the ctdb tunable variables, using the 'ctdb
listvars' command.
3. Increment the value of one of the variables using the 'setvar' control on
one of the nodes. E.g. 'ctdb setvar RecoverTimeout 31'.
4. Verify that the 'listvars' control now shows the new value for the
variable.
Expected results:
* After setting a value using 'ctdb setvar', 'ctdb listvars' shows the
modified value of the variable.
Verify the operation of "ctdb listvars", "ctdb getvar", "ctdb setvar"
EOF
}
@ -38,9 +15,31 @@ set -e
cluster_is_healthy
# Reset configuration
ctdb_restart_when_done
try_command_on_node -v 0 "$CTDB listvars"
sanity_check_output \
5 \
'^[[:alpha:]][[:alnum:]]+[[:space:]]*=[[:space:]]*[[:digit:]]+$' \
"$out"
echo "Verifying all variable values using \"ctdb getvar\"..."
echo "$out" |
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
echo "GOOD: all tunables match"
var="RecoverTimeout"
try_command_on_node -v 0 $CTDB getvar $var

View File

@ -1,51 +0,0 @@
#!/bin/bash
test_info()
{
cat <<EOF
Verify that 'ctdb getvar' works correctly.
Expands on the steps below as it actually checks the values of all
variables listed by 'ctdb listvars'.
Prerequisites:
* An active CTDB cluster with at least 2 active nodes.
Steps:
1. Verify that the status on all of the ctdb nodes is 'OK'.
2. Run 'ctdb getvars <varname>' with a valid variable name (possibly
obtained via 'ctdb listvars'.
3. Verify that the command displays the correct value of the variable
(corroborate with the value shown by 'ctdb listvars'.
Expected results:
* 'ctdb getvar' shows the correct value of the variable.
EOF
}
. "${TEST_SCRIPTS_DIR}/integration.bash"
ctdb_test_init "$@"
set -e
cluster_is_healthy
try_command_on_node -v 0 "$CTDB listvars"
echo "Verifying all variable values using \"ctdb getvar\"..."
echo "$out" |
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