[SCM] Samba Shared Repository - branch master updated
Martin Schwenke
martins at samba.org
Wed Jul 22 09:15:06 UTC 2020
The branch, master has been updated
via 484a764e832 ctdb-tests: Improve test portability/quality
via f4c2c77ff72 ctdb-tests: Improve test quality
via c6c81ea2879 ctdb-tests: Improve test portability
via 244eaad76a8 ctdb-tests: Improve test quality
via 760c3039b07 ctdb-tests: Improve test portability
via 41ff58338a0 ctdb-tests: Drop uses of "onnode any ..." in testcases
via ce3de398947 ctdb-tests: Don't bother shutting down daemons in ctdb_init()
via 37c26a9590b ctdb-tests: Separate custom cluster startup from test initialisation
via a766136df45 ctdb-tests: Do not trigger ctdb_test_error() from ctdb_init()
via a369bedf8c5 ctdb-tests: Make unit.sh pass shellcheck
via be3065ea958 ctdb-tests: Make integration.bash pass shellcheck
via d6673528050 ctdb-tests: Use "#!/usr/bin/env bash" for improved portability
via 8b24cae6303 ctdb-tests: Update preamble for INTEGRATION tests
via 0f201dd67a0 ctdb-tests: Drop unreachable line
via 29a3fce28f3 ctdb-tests: Redirect stderr too when checking for shellcheck
via 1565446508f ctdb-tests: Show hung script debugging output
via 70c38d404b4 ctdb-tests: Enable SOCKET_WRAPPER_DIR_ALLOW_ORIG
via 066c205e5fb ctdb-build: Don't build/install tests in top-level build by default
via 3ff8765d04c ctdb-tests: Stop cat command failure from causing test failure
from 6436c74ebf6 Revert "ctdb-build: Don't build/install tests in top-level build by default"
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 484a764e832bcfcaf15a1c6f157643bd0e0df5d1
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Mar 6 05:10:05 2020 +1100
ctdb-tests: Improve test portability/quality
Avoid use of non-portable md5sum by constructing database names using
index. Improve indentation, use more modern commands, code
improvements (shellcheck).
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
Autobuild-User(master): Martin Schwenke <martins at samba.org>
Autobuild-Date(master): Wed Jul 22 09:14:35 UTC 2020 on sn-devel-184
commit f4c2c77ff726dd7d28a7d8c3cd815c802a8a6cfa
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Mar 5 21:53:33 2020 +1100
ctdb-tests: Improve test quality
Simplify code, use more modern commands, code improvements (shellcheck).
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit c6c81ea287924c2924aebc6dc0cdea1dc4322ae2
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Mar 5 21:48:59 2020 +1100
ctdb-tests: Improve test portability
"wc -l" on some platforms (e.g. FreeBSD) contains leading spaces, so
strip them.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 244eaad76a83f13399c3fffbde4783ecb1bc9f85
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Mar 5 20:42:01 2020 +1100
ctdb-tests: Improve test quality
Select test node with IPs instead of using a fixed node. Remove
unnecessary code, use more modern commands, code
improvements (shellcheck).
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 760c3039b0752204090b493132ad32bad4140064
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Mar 5 20:21:26 2020 +1100
ctdb-tests: Improve test portability
"wc -l" on some platforms (e.g. FreeBSD) contains leading spaces and
stops "$num from being a number. Create a more portable solution and
put it in a function instead of repeating the logic.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 41ff58338a0b36dfccc19579c8edfa5939cd5978
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Dec 10 11:33:02 2019 +1100
ctdb-tests: Drop uses of "onnode any ..." in testcases
It would be nice to get rid of "onnode any". There's no use making
tests nondeterministic. If covering different cases matters then they
should be explicitly handled.
In most places "any" is replaced by "$test_node". In some cases,
where $test_node is not set, a fixed node that is already used
elsewhere can be reused.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit ce3de3989470d186ce73e6e74aa7f16111e2a6fa
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Dec 10 14:47:23 2019 +1100
ctdb-tests: Don't bother shutting down daemons in ctdb_init()
They'll never be up here...
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 37c26a9590b2d6712b38cf249538b512c6f6b546
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Dec 10 14:44:45 2019 +1100
ctdb-tests: Separate custom cluster startup from test initialisation
Separate cluster startup from test initialisation for tests that start
the cluster with customised configuration. In these cases the result
of the cluster startup is actually the point of the test.
Additionally, pubips.013.failover_noop.sh claims to have completed
test initialisation twice, which just seems wrong.
The result is:
* ctdb_test_init() takes one option (-n) to indicate when it should
not configure/start the cluster
* New function ctdb_nodes_start_custom() accepts options for special
cluster configuration, only operates on local daemons and triggers a
test failure rather than a test error on failure.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit a766136df459df33becd05726253b83d32993a94
Author: Martin Schwenke <martin at meltin.net>
Date: Mon Jul 6 11:56:16 2020 +1000
ctdb-tests: Do not trigger ctdb_test_error() from ctdb_init()
The only caller calls ctdb_test_error() on failure and nesting this
calls can be confusing. A future change will make this even more
confusing.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit a369bedf8c5eee75748cdbd6a1a900ca9ac4da9e
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Apr 30 14:35:12 2020 +1000
ctdb-tests: Make unit.sh pass shellcheck
Mostly avoidance of quoting warnings.
Silencing warnings about unquoted $CTDB_TEST_CAT_RESULTS_OPTS is
handled by passing '-' to cat when that variable's value is empty.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit be3065ea958b27ec297078008c2ce33b4a419820
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Mar 6 05:58:26 2020 +1100
ctdb-tests: Make integration.bash pass shellcheck
Apart from the non-constant sourcing of include files.
Mostly avoidance of quoting warnings.
One subtle change is to simply pass "120" to wait_until_ready() to
stop warnings that it expects arguments but none are passed (both
SC2119 and SC2120). There seems no way to indicate to structure
function argument handling so that shellcheck realises arguments are
optional. In later shellcheck versions, disabling SC2120 for a
function also silences complaints about its callers... but not all of
our testing uses "later" shellcheck versions.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit d6673528050cd66b215cd6153df9015fca1396f2
Author: Martin Schwenke <martin at meltin.net>
Date: Wed Mar 4 13:55:07 2020 +1100
ctdb-tests: Use "#!/usr/bin/env bash" for improved portability
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 8b24cae630306870de9c9c7bdfac8da3fef489fd
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Dec 10 14:50:42 2019 +1100
ctdb-tests: Update preamble for INTEGRATION tests
* Use "#!/usr/bin/env bash" for improved portability
* Drop test_info() definition and replace it with a comment
The use of test_info() is pointless.
* Drop call to cluster_is_healthy()
This is a holdover from when the previous test would restart daemons
to get things ready for a test. There was also a bug where going
into recovery during the restart would sometimes cause the cluster
to become unhealthy. If we really need something like this then we
can add it to ctdb_test_init().
* Make order of preamble consistent
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 0f201dd67a019d4d64011b894ebf542b109afef4
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Apr 30 14:14:43 2020 +1000
ctdb-tests: Drop unreachable line
ctdb_test_skip() will exit.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 29a3fce28f380e3b5c2e44a697fbf35be2a139da
Author: Martin Schwenke <martin at meltin.net>
Date: Wed Mar 11 16:33:27 2020 +1100
ctdb-tests: Redirect stderr too when checking for shellcheck
Avoid:
.../UNIT/shellcheck/scripts/local.sh: line 14: type: shellcheck: not found
The "type" command in dash prints the "not found" message to stdout
but the bash version prints to stderr, so redirect stderr too.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 1565446508fcf2bdd1ae9c39cc3822417cd91dc8
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Apr 21 11:34:12 2020 +1000
ctdb-tests: Show hung script debugging output
The output in a test failure appears to contain no pstree output
because "00\.test\.script,.*" does not match. However, this is just a
guess because the output is not shown.
Showing the output makes it easier to understand test failures.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 70c38d404b480c0b63621bd1faf002485faac531
Author: Martin Schwenke <martin at meltin.net>
Date: Wed May 13 14:04:36 2020 +1000
ctdb-tests: Enable SOCKET_WRAPPER_DIR_ALLOW_ORIG
This will allow local daemons to be used in more contexts, especially
in tests run by Jenkins where the directory names for some targets can
be very long.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 066c205e5fb0e28bb5cab61a583889bb85607fb9
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Feb 16 19:23:44 2017 +1100
ctdb-build: Don't build/install tests in top-level build by default
The standalone build still includes tests, as does the top-level build
when --enable-selftest is used. The latter is consistent with the use
of --enable-selftest in the rest of the tree.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 3ff8765d04c0fb950b7be4f9a049999aeb08223b
Author: Martin Schwenke <martin at meltin.net>
Date: Mon Jul 6 14:02:49 2020 +1000
ctdb-tests: Stop cat command failure from causing test failure
In certain circumstance, which aren't obvious, cat(1) can fail when
attempting to write a lot of data. This is due to something (probably
write(2)) returning EAGAIN.
Given that the -v option should only really be used for test
debugging, ignore the failure instead of spending time debugging it.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14446
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
-----------------------------------------------------------------------
Summary of changes:
ctdb/tests/CLUSTER/complex/18_ctdb_reloadips.sh | 8 +-
ctdb/tests/CLUSTER/complex/31_nfs_tickle.sh | 9 +-
.../tests/CLUSTER/complex/34_nfs_tickle_restart.sh | 5 -
.../INTEGRATION/database/basics.001.attach.sh | 77 ++++--------
.../INTEGRATION/database/basics.002.attach.sh | 39 ++----
.../INTEGRATION/database/basics.003.detach.sh | 31 +----
ctdb/tests/INTEGRATION/database/basics.004.wipe.sh | 35 ++----
.../database/basics.010.backup_restore.sh | 39 ++----
ctdb/tests/INTEGRATION/database/fetch.001.ring.sh | 17 +--
.../INTEGRATION/database/fetch.002.ring-hotkeys.sh | 2 +-
.../INTEGRATION/database/readonly.001.basic.sh | 52 +++-----
.../INTEGRATION/database/recovery.001.volatile.sh | 66 ++++------
.../INTEGRATION/database/recovery.002.large.sh | 34 ++---
.../database/recovery.003.no_resurrect.sh | 14 +--
.../database/recovery.010.persistent.sh | 41 ++----
.../INTEGRATION/database/recovery.011.continue.sh | 35 ++----
.../INTEGRATION/database/transaction.001.ptrans.sh | 29 +----
.../INTEGRATION/database/transaction.002.loop.sh | 17 +--
.../database/transaction.003.loop_recovery.sh | 23 +---
.../database/transaction.004.update_record.sh | 49 +++-----
.../database/transaction.010.loop_recovery.sh | 25 ++--
.../tests/INTEGRATION/database/traverse.001.one.sh | 26 ++--
.../INTEGRATION/database/traverse.002.many.sh | 32 ++---
ctdb/tests/INTEGRATION/database/vacuum.001.fast.sh | 2 +-
ctdb/tests/INTEGRATION/database/vacuum.002.full.sh | 2 +-
.../INTEGRATION/database/vacuum.003.recreate.sh | 2 +-
.../INTEGRATION/database/vacuum.030.locked.sh | 2 +-
.../INTEGRATION/database/vacuum.031.locked.sh | 2 +-
.../INTEGRATION/database/vacuum.032.locked.sh | 2 +-
.../INTEGRATION/database/vacuum.033.locked.sh | 2 +-
.../INTEGRATION/database/vacuum.034.locked.sh | 2 +-
ctdb/tests/INTEGRATION/failover/pubips.001.list.sh | 29 +----
.../tests/INTEGRATION/failover/pubips.010.addip.sh | 16 +--
.../tests/INTEGRATION/failover/pubips.011.delip.sh | 16 +--
.../INTEGRATION/failover/pubips.012.reloadips.sh | 32 ++---
.../failover/pubips.013.failover_noop.sh | 33 +++--
.../INTEGRATION/failover/pubips.014.iface_gc.sh | 13 +-
.../INTEGRATION/failover/pubips.020.moveip.sh | 26 ++--
.../failover/pubips.030.disable_enable.sh | 15 +--
.../failover/pubips.032.stop_continue.sh | 13 +-
.../failover/pubips.040.NoIPTakeover.sh | 107 ++++++++--------
.../INTEGRATION/failover/pubips.050.missing_ip.sh | 19 +--
ctdb/tests/INTEGRATION/simple/basics.000.onnode.sh | 25 +---
.../INTEGRATION/simple/basics.001.listnodes.sh | 28 +----
.../INTEGRATION/simple/basics.002.tunables.sh | 13 +-
ctdb/tests/INTEGRATION/simple/basics.003.ping.sh | 44 ++-----
ctdb/tests/INTEGRATION/simple/basics.004.getpid.sh | 28 +----
.../simple/basics.005.process_exists.sh | 34 +----
.../INTEGRATION/simple/basics.010.statistics.sh | 29 +----
.../simple/basics.011.statistics_reset.sh | 31 +----
.../simple/cluster.001.isnotrecmaster.sh | 30 +----
.../simple/cluster.002.recmaster_yield.sh | 28 +----
.../INTEGRATION/simple/cluster.010.getrelock.sh | 40 +++---
.../simple/cluster.012.reclock_command.sh | 21 ++--
.../simple/cluster.015.reclock_remove_lock.sh | 2 +-
.../simple/cluster.016.reclock_move_lock_dir.sh | 2 +-
.../INTEGRATION/simple/cluster.020.message_ring.sh | 17 +--
.../INTEGRATION/simple/cluster.021.tunnel_ring.sh | 17 +--
.../INTEGRATION/simple/cluster.090.unreachable.sh | 40 +-----
.../simple/cluster.091.version_check.sh | 11 +-
.../tests/INTEGRATION/simple/debug.001.getdebug.sh | 26 +---
.../tests/INTEGRATION/simple/debug.002.setdebug.sh | 19 +--
.../INTEGRATION/simple/debug.003.dumpmemory.sh | 26 +---
.../simple/eventscripts.001.zero_scripts.sh | 15 +--
.../simple/eventscripts.090.debug_hung.sh | 24 ++--
ctdb/tests/UNIT/shellcheck/scripts/local.sh | 3 +-
ctdb/tests/UNIT/shellcheck/tests.sh | 4 +-
ctdb/tests/local_daemons.sh | 1 +
ctdb/tests/scripts/integration.bash | 139 +++++++++++++--------
ctdb/tests/scripts/test_wrap | 2 +-
ctdb/tests/scripts/unit.sh | 15 ++-
ctdb/wscript | 7 ++
72 files changed, 538 insertions(+), 1223 deletions(-)
Changeset truncated at 500 lines:
diff --git a/ctdb/tests/CLUSTER/complex/18_ctdb_reloadips.sh b/ctdb/tests/CLUSTER/complex/18_ctdb_reloadips.sh
index f4df2b1b08b..150aeea5f14 100755
--- a/ctdb/tests/CLUSTER/complex/18_ctdb_reloadips.sh
+++ b/ctdb/tests/CLUSTER/complex/18_ctdb_reloadips.sh
@@ -38,7 +38,7 @@ select_test_node_and_ips
# the provided prefix. Note that this is an IPv4-specific test.
echo "Getting public IP information from CTDB..."
-try_command_on_node any "$CTDB ip -X -v all"
+ctdb_onnode "$test_node" "ip -X -v all"
ctdb_ip_info=$(awk -F'|' 'NR > 1 { print $2, $3, $5 }' "$outfile")
echo "Getting IP information from interfaces..."
@@ -215,7 +215,7 @@ do_ctdb_reloadips
check_ips $test_node "$iface" "$prefix" 1 $new_ip_max
-try_command_on_node any $CTDB sync
+ctdb_onnode "$test_node" sync
####################
@@ -229,7 +229,7 @@ do_ctdb_reloadips
check_ips $test_node "$iface" "$prefix" 2 $new_ip_max
-try_command_on_node any $CTDB sync
+ctdb_onnode "$test_node" sync
####################
@@ -244,7 +244,7 @@ do_ctdb_reloadips
check_ips $test_node "$iface" "$prefix" $start $new_ip_max
-try_command_on_node any $CTDB sync
+ctdb_onnode "$test_node" sync
####################
diff --git a/ctdb/tests/CLUSTER/complex/31_nfs_tickle.sh b/ctdb/tests/CLUSTER/complex/31_nfs_tickle.sh
index e3c362c347a..e3f1540aedb 100755
--- a/ctdb/tests/CLUSTER/complex/31_nfs_tickle.sh
+++ b/ctdb/tests/CLUSTER/complex/31_nfs_tickle.sh
@@ -29,15 +29,14 @@ set -e
ctdb_test_init
-# We need this for later, so we know how long to run nc for.
-try_command_on_node any $CTDB getvar MonitorInterval
-monitor_interval="${out#*= }"
-#echo "Monitor interval on node $test_node is $monitor_interval seconds."
-
select_test_node_and_ips
try_command_on_node $test_node "$CTDB listnodes | wc -l"
numnodes="$out"
+# We need this for later, so we know how long to run nc for.
+ctdb_onnode "$test_node" "getvar MonitorInterval"
+monitor_interval="${out#*= }"
+
test_port=2049
echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."
diff --git a/ctdb/tests/CLUSTER/complex/34_nfs_tickle_restart.sh b/ctdb/tests/CLUSTER/complex/34_nfs_tickle_restart.sh
index 5ab8a34faec..b81510d3722 100755
--- a/ctdb/tests/CLUSTER/complex/34_nfs_tickle_restart.sh
+++ b/ctdb/tests/CLUSTER/complex/34_nfs_tickle_restart.sh
@@ -27,11 +27,6 @@ set -e
ctdb_test_init
-# We need this for later, so we know how long to run nc for.
-try_command_on_node any $CTDB getvar MonitorInterval
-monitor_interval="${out#*= }"
-#echo "Monitor interval on node $test_node is $monitor_interval seconds."
-
select_test_node_and_ips
try_command_on_node $test_node "$CTDB listnodes -X"
listnodes_output="$out"
diff --git a/ctdb/tests/INTEGRATION/database/basics.001.attach.sh b/ctdb/tests/INTEGRATION/database/basics.001.attach.sh
index bcec20afc5e..1fbffc58436 100755
--- a/ctdb/tests/INTEGRATION/database/basics.001.attach.sh
+++ b/ctdb/tests/INTEGRATION/database/basics.001.attach.sh
@@ -1,44 +1,18 @@
-#!/bin/bash
+#!/usr/bin/env bash
-test_info()
-{
- cat <<EOF
-Verify that 'ctdb getdbmap' operates as expected.
-
-This test creates some test databases using 'ctdb attach'.
-
-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 the database on using 'ctdb getdbmap'.
-3. Verify that the output is valid.
-
-Expected results:
-
-* 'ctdb getdbmap' shows a valid listing of databases.
-EOF
-}
+# Verify that 'ctdb getdbmap' operates as expected
. "${TEST_SCRIPTS_DIR}/integration.bash"
-ctdb_test_init
-
set -e
-cluster_is_healthy
+ctdb_test_init
-make_temp_db_filename ()
-{
- dd if=/dev/urandom count=1 bs=512 2>/dev/null |
- md5sum |
- awk '{printf "%s.tdb\n", $1}'
-}
+select_test_node
-try_command_on_node -v 0 "$CTDB getdbmap"
+# test_node set by select_test_node() above
+# shellcheck disable=SC2154
+ctdb_onnode -v "$test_node" getdbmap
dbid='dbid:0x[[:xdigit:]]+'
name='name:[^[:space:]]+'
@@ -47,27 +21,28 @@ opts='( (PERSISTENT|STICKY|READONLY|REPLICATED|UNHEALTHY))*'
line="${dbid} ${name} ${path}${opts}"
dbmap_pattern="^(Number of databases:[[:digit:]]+|${line})\$"
+# outfile set by ctdb_onnode() above
+# shellcheck disable=SC2154
num_db_init=$(sed -n -e '1s/.*://p' "$outfile")
sanity_check_output $(($num_db_init + 1)) "$dbmap_pattern"
for i in $(seq 1 5) ; do
- f=$(make_temp_db_filename)
- echo "Creating test database: $f"
- try_command_on_node 0 $CTDB attach "$f"
- try_command_on_node 0 $CTDB getdbmap
- sanity_check_output $(($num_db_init + 1)) "$dbmap_pattern"
- num=$(sed -n -e '1s/^.*://p' "$outfile")
- if [ $num = $(($num_db_init + $i)) ] ; then
- echo "OK: correct number of additional databases"
- else
- echo "BAD: no additional database"
- exit 1
- fi
- if awk '{print $2}' "$outfile" | grep -Fqx "name:$f" ; then
- echo "OK: getdbmap knows about \"$f\""
- else
- echo "BAD: getdbmap does not know about \"$f\""
- exit 1
- fi
+ f="attach_test_${i}.tdb"
+ echo "Creating test database: $f"
+ ctdb_onnode "$test_node" "attach ${f}"
+
+ ctdb_onnode "$test_node" getdbmap
+ sanity_check_output $((num_db_init + 1)) "$dbmap_pattern"
+ num=$(sed -n -e '1s/^.*://p' "$outfile")
+ if [ "$num" = $((num_db_init + i)) ] ; then
+ echo "OK: correct number of additional databases"
+ else
+ ctdb_test_fail "BAD: no additional database"
+ fi
+ if awk '{print $2}' "$outfile" | grep -Fqx "name:$f" ; then
+ echo "OK: getdbmap knows about \"$f\""
+ else
+ ctdb_test_fail "BAD: getdbmap does not know about \"$f\""
+ fi
done
diff --git a/ctdb/tests/INTEGRATION/database/basics.002.attach.sh b/ctdb/tests/INTEGRATION/database/basics.002.attach.sh
index ae09741f980..6a5c812f35a 100755
--- a/ctdb/tests/INTEGRATION/database/basics.002.attach.sh
+++ b/ctdb/tests/INTEGRATION/database/basics.002.attach.sh
@@ -1,38 +1,19 @@
-#!/bin/bash
-
-test_info()
-{
- cat <<EOF
-Verify the operation of 'ctdb attach' command.
-
-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. Shut down one of the nodes
-3. Attach test databases
-4. Start shutdown node
-5. Verify that the databases are attached.
-6. Restart one of the nodes
-7. Verify that the databses are attached.
+#!/usr/bin/env bash
-
-Expected results:
-
-* Command 'ctdb attach' command successfully attaches databases.
-EOF
-}
+# Verify that databases are attached a node joins the cluster:
+# 1. Shut down CTDB on one node
+# 2. Attach test databases
+# 3. Check that databases are attached on all up nodes
+# 4. Start CTDB on the node where it is shut down
+# 5. Verify that the test databases are attached on this node
+# 6. Restart one of the nodes
+# 7. Verify that the test databases are attached on this node
. "${TEST_SCRIPTS_DIR}/integration.bash"
-ctdb_test_init
-
set -e
-cluster_is_healthy
+ctdb_test_init
######################################################################
diff --git a/ctdb/tests/INTEGRATION/database/basics.003.detach.sh b/ctdb/tests/INTEGRATION/database/basics.003.detach.sh
index 5d1e12328c6..cb44955d1e8 100755
--- a/ctdb/tests/INTEGRATION/database/basics.003.detach.sh
+++ b/ctdb/tests/INTEGRATION/database/basics.003.detach.sh
@@ -1,34 +1,15 @@
-#!/bin/bash
+#!/usr/bin/env bash
-test_info()
-{
- cat <<EOF
-Verify the operation of 'ctdb detach' command.
-
-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. Attach test databases
-3. Detach test databases
-4. Verify that the databases are not attached.
-
-Expected results:
-
-* Command 'ctdb detach' command successfully removes attached databases.
-EOF
-}
+# Verify that 'ctdb detach' works as expected:
+# 1. Attach test databases
+# 2. Detach test databases
+# 3. Confirm test databases are not attached
. "${TEST_SCRIPTS_DIR}/integration.bash"
-ctdb_test_init
-
set -e
-cluster_is_healthy
+ctdb_test_init
######################################################################
diff --git a/ctdb/tests/INTEGRATION/database/basics.004.wipe.sh b/ctdb/tests/INTEGRATION/database/basics.004.wipe.sh
index 9305339d1e3..115d64cd606 100755
--- a/ctdb/tests/INTEGRATION/database/basics.004.wipe.sh
+++ b/ctdb/tests/INTEGRATION/database/basics.004.wipe.sh
@@ -1,36 +1,17 @@
-#!/bin/bash
+#!/usr/bin/env bash
-test_info()
-{
- cat <<EOF
-The command 'ctdb wipedb' is used to clear a database across the whole
-cluster.
-
-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. Create a persistent test database
-3. Add some records to node #0 and node #1
-4. Perform wipedb on node #0 and verify the database is empty on both node 0 and 1
-
-Expected results:
-
-* An empty database will result
-
-EOF
-}
+# Verify that 'ctdb wipedb' can clear a persistent database:
+# 1. Verify that the status on all of the ctdb nodes is 'OK'.
+# 2. Create a persistent test database
+# 3. Add some records to node 0 and node 1
+# 4. Run wipedb on node 0
+# 5. verify the database is empty on both node 0 and 1
. "${TEST_SCRIPTS_DIR}/integration.bash"
-ctdb_test_init
-
set -e
-cluster_is_healthy
+ctdb_test_init
try_command_on_node 0 "$CTDB listnodes | wc -l"
num_nodes="$out"
diff --git a/ctdb/tests/INTEGRATION/database/basics.010.backup_restore.sh b/ctdb/tests/INTEGRATION/database/basics.010.backup_restore.sh
index 579233e0e80..8c469d4642b 100755
--- a/ctdb/tests/INTEGRATION/database/basics.010.backup_restore.sh
+++ b/ctdb/tests/INTEGRATION/database/basics.010.backup_restore.sh
@@ -1,39 +1,18 @@
-#!/bin/bash
+#!/usr/bin/env bash
-test_info()
-{
- cat <<EOF
-The command 'ctdb restoredb' is used to restore a database across the
-whole cluster.
-
-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. Create a persistent test database
-3. Add some records to test database
-4. Backup database
-5. Wipe database and verify the database is empty on all nodes
-6. Restore database and make sure all the records are restored
-7. Make sure no recovery has been triggered
-
-Expected results:
-
-* Database operations should not cause a recovery
-
-EOF
-}
+# Confirm that 'ctdb restoredb' works correctly:
+# 1. Create a persistent test database
+# 2. Add some records to test database
+# 3. Backup database
+# 4. Wipe database and verify the database is empty on all nodes
+# 5. Restore database and make sure all the records are restored
+# 6. Make sure no recovery has been triggered
. "${TEST_SCRIPTS_DIR}/integration.bash"
-ctdb_test_init
-
set -e
-cluster_is_healthy
+ctdb_test_init
try_command_on_node 0 $CTDB status
generation=$(sed -n -e 's/^Generation:\([0-9]*\)/\1/p' "$outfile")
diff --git a/ctdb/tests/INTEGRATION/database/fetch.001.ring.sh b/ctdb/tests/INTEGRATION/database/fetch.001.ring.sh
index 33df07b7d88..4d7d392240d 100755
--- a/ctdb/tests/INTEGRATION/database/fetch.001.ring.sh
+++ b/ctdb/tests/INTEGRATION/database/fetch.001.ring.sh
@@ -1,23 +1,12 @@
-#!/bin/bash
+#!/usr/bin/env bash
-test_info()
-{
- cat <<EOF
-Run the fetch_ring test and sanity check the output.
-
-Prerequisites:
-
-* An active CTDB cluster with at least 2 active nodes.
-EOF
-}
+# Run the fetch_ring test and sanity check the output
. "${TEST_SCRIPTS_DIR}/integration.bash"
-ctdb_test_init
-
set -e
-cluster_is_healthy
+ctdb_test_init
try_command_on_node 0 "$CTDB listnodes | wc -l"
num_nodes="$out"
diff --git a/ctdb/tests/INTEGRATION/database/fetch.002.ring-hotkeys.sh b/ctdb/tests/INTEGRATION/database/fetch.002.ring-hotkeys.sh
index c4e0023e11c..6d442535a21 100755
--- a/ctdb/tests/INTEGRATION/database/fetch.002.ring-hotkeys.sh
+++ b/ctdb/tests/INTEGRATION/database/fetch.002.ring-hotkeys.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Run the fetch_ring test, sanity check the output and check hot keys
# statistics
diff --git a/ctdb/tests/INTEGRATION/database/readonly.001.basic.sh b/ctdb/tests/INTEGRATION/database/readonly.001.basic.sh
index a83b4d31530..aeb974028e6 100755
--- a/ctdb/tests/INTEGRATION/database/readonly.001.basic.sh
+++ b/ctdb/tests/INTEGRATION/database/readonly.001.basic.sh
@@ -1,46 +1,28 @@
-#!/bin/bash
+#!/usr/bin/env bash
-test_info()
-{
- cat <<EOF
-Read-only records can be activated at runtime using a ctdb command.
-If read-only records are not activated, then any attempt to fetch a read-only
-copy should be automatically upgraded to a read-write fetch_lock().
-
-If read-only delegations are present, then any attempt to aquire a read-write
-fetch_lock will trigger all delegations to be revoked before the fetch lock
-completes.
-
-
-Prerequisites:
-
-* An active CTDB cluster with at least 2 active nodes.
-
-Steps:
+# Test support for read-only records
-1. Verify that the status on all of the ctdb nodes is 'OK'.
-2. create a test database and some records
-3. try to fetch read-only records, this should not result in any delegations
-4. activate read-only support
-5. try to fetch read-only records, this should result in delegations
-6. do a fetchlock and the delegations should be revoked
-7. try to fetch read-only records, this should result in delegations
-8. do a recovery and the delegations should be revoked
+# Read-only records can be activated at runtime using a ctdb command.
+# If read-only records are not activated, then any attempt to fetch a
+# read-only copy should be automatically upgraded to a read-write
+# fetch_locked().
-Expected results:
+# If read-only delegations are present, then any attempt to acquire a
+# read-write fetch_lock will trigger revocation of all delegations
+# before the fetch_locked().
-Delegations should be created and revoked as above
-
-EOF
-}
+# 1. Create a test database and some records
+# 2. Try to fetch read-only records, this should not result in any delegations
+# 3. Activate read-only support
+# 4. Try to fetch read-only records, this should result in delegations
+# 5. Do a fetchlock and the delegations should be revoked
+# 6. Try to fetch read-only records, this should result in delegations
. "${TEST_SCRIPTS_DIR}/integration.bash"
-ctdb_test_init
-
set -e
-cluster_is_healthy
+ctdb_test_init
######################################################################
@@ -110,7 +92,7 @@ check_readonly ()
######################################################################
echo "Get list of nodes..."
-try_command_on_node any $CTDB -X listnodes
+ctdb_onnode 0 "-X listnodes"
all_nodes=$(awk -F'|' '{print $2}' "$outfile")
######################################################################
--
Samba Shared Repository
More information about the samba-cvs
mailing list