The branch, master has been updated
       via  5707781ccf6 ctdb-tests: Stop cat command failure from causing test 
failure
       via  d2f8cd835da ctdb-tests: Improve test portability/quality
       via  a308f2534d3 ctdb-tests: Improve test quality
       via  1f6556916e7 ctdb-tests: Improve test portability
       via  ea1cbff6243 ctdb-tests: Improve test quality
       via  1079d6e3ae5 ctdb-tests: Improve test portability
       via  aa5b214eaa8 ctdb-tests: Drop uses of "onnode any ..." in testcases
       via  58f9f699f18 ctdb-tests: Don't bother shutting down daemons in 
ctdb_init()
       via  e9df17b5001 ctdb-tests: Separate custom cluster startup from test 
initialisation
       via  44e05ac8515 ctdb-tests: Do not trigger ctdb_test_error() from 
ctdb_init()
       via  30293baae5f ctdb-tests: Make unit.sh pass shellcheck
       via  0f04b8a70be ctdb-tests: Make integration.bash pass shellcheck
       via  9a7cabd342d ctdb-tests: Use "#!/usr/bin/env bash" for improved 
portability
       via  65f56505e29 ctdb-tests: Update preamble for INTEGRATION tests
       via  a55dd6f17b6 ctdb-tests: Drop unreachable line
       via  847aa0e367c ctdb-tests: Redirect stderr too when checking for 
shellcheck
       via  c78de201f84 ctdb-tests: Show hung script debugging output
       via  9694ba6fe4d ctdb-tests: Enable SOCKET_WRAPPER_DIR_ALLOW_ORIG
       via  91c36c16c85 ctdb-build: Don't build/install tests in top-level 
build by default
      from  da1103dbdc9 smbd: build smb_fname per file to delete in 
unlink_internals()

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5707781ccf682d95a5a05a7c3e00a43003dbe62e
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>
    
    Autobuild-User(master): Amitay Isaacs <ami...@samba.org>
    Autobuild-Date(master): Wed Jul 22 04:10:47 UTC 2020 on sn-devel-184

commit d2f8cd835da39784f2d99231f9a1067ae56ede7a
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit a308f2534d3991866efa2c662921ec63b4238888
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit 1f6556916e7f3a731d7d760fa6fd857e7f571541
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit ea1cbff624383fb9d5b83b863fa6bd00a8fb77fa
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit 1079d6e3ae5805ef65a3628edf0a3ac2cd7fac1c
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit aa5b214eaa88414c87410fd068fe7624e9790185
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit 58f9f699f181ac217cda8de512b8385da173f884
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit e9df17b500146e62539feac66d0cd4b3ef7aa47a
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit 44e05ac8515be3220a334ae8001db83b06bec59f
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit 30293baae5f22628405d327fc0b6bae993e96cd8
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit 0f04b8a70be3b8e157a4a88e9e54e87fa380022e
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit 9a7cabd342d0aed450ed3305931702a7351f814a
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit 65f56505e29c01d5891e5bc1050b6c37b8cbdee7
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit a55dd6f17b6d65db77bcd4f5a011e9aef64729e5
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit 847aa0e367c721944650aa34d67f8073461ae272
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit c78de201f84f9fae9916af9592d42cbc71f805c5
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit 9694ba6fe4d073c653f49080127ee9efa21a8e9e
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

commit 91c36c16c8516359380a00ee3d2229422b048d9f
Author: Martin Schwenke <mar...@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 <mar...@meltin.net>

-----------------------------------------------------------------------

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

Reply via email to