summaryrefslogtreecommitdiff
path: root/ctdb/tests
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2018-10-08 12:05:42 +1100
committerAmitay Isaacs <amitay@samba.org>2018-11-06 07:16:15 +0100
commit43c26e1e645f1f2ac85c7b03a148158534eee567 (patch)
tree82864451200d2bf8026ed9072232f8b2f5721fd8 /ctdb/tests
parentba86eacb66e8979781f4b1c3a486c17ca52624f1 (diff)
downloadsamba-43c26e1e645f1f2ac85c7b03a148158534eee567.tar.gz
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>
Diffstat (limited to 'ctdb/tests')
-rwxr-xr-xctdb/tests/simple/02_ctdb_listvars.sh41
-rwxr-xr-xctdb/tests/simple/02_ctdb_tunables.sh (renamed from ctdb/tests/simple/04_ctdb_setvar.sh)49
-rwxr-xr-xctdb/tests/simple/03_ctdb_getvar.sh51
3 files changed, 24 insertions, 117 deletions
diff --git a/ctdb/tests/simple/02_ctdb_listvars.sh b/ctdb/tests/simple/02_ctdb_listvars.sh
deleted file mode 100755
index 2f709a8cc0d..00000000000
--- a/ctdb/tests/simple/02_ctdb_listvars.sh
+++ /dev/null
@@ -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"
diff --git a/ctdb/tests/simple/04_ctdb_setvar.sh b/ctdb/tests/simple/02_ctdb_tunables.sh
index 7d1d495211b..e6caf3d625a 100755
--- a/ctdb/tests/simple/04_ctdb_setvar.sh
+++ b/ctdb/tests/simple/02_ctdb_tunables.sh
@@ -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
diff --git a/ctdb/tests/simple/03_ctdb_getvar.sh b/ctdb/tests/simple/03_ctdb_getvar.sh
deleted file mode 100755
index cae3dd14159..00000000000
--- a/ctdb/tests/simple/03_ctdb_getvar.sh
+++ /dev/null
@@ -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