From: Martin Schwenke Date: Tue, 10 Dec 2019 03:50:42 +0000 (+1100) Subject: ctdb-tests: Update preamble for INTEGRATION tests X-Git-Tag: talloc-2.3.2~1016 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b24cae630306870de9c9c7bdfac8da3fef489fd;p=thirdparty%2Fsamba.git 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 Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/INTEGRATION/database/basics.001.attach.sh b/ctdb/tests/INTEGRATION/database/basics.001.attach.sh index bcec20afc5e..e5c6b81ba65 100755 --- a/ctdb/tests/INTEGRATION/database/basics.001.attach.sh +++ b/ctdb/tests/INTEGRATION/database/basics.001.attach.sh @@ -1,35 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat </dev/null 2>&1" } -. "${TEST_SCRIPTS_DIR}/integration.bash" - -ctdb_test_init - -set -e - -cluster_is_healthy - TESTDB="persistent_trans.tdb" try_command_on_node 0 "$CTDB attach $TESTDB persistent" diff --git a/ctdb/tests/INTEGRATION/database/transaction.004.update_record.sh b/ctdb/tests/INTEGRATION/database/transaction.004.update_record.sh index 90b5ee06151..528303a6435 100755 --- a/ctdb/tests/INTEGRATION/database/transaction.004.update_record.sh +++ b/ctdb/tests/INTEGRATION/database/transaction.004.update_record.sh @@ -1,38 +1,21 @@ -#!/bin/bash - -test_info() -{ - cat </dev/null 2>&1" } -. "${TEST_SCRIPTS_DIR}/integration.bash" - -ctdb_test_init - -set -e - -cluster_is_healthy - TESTDB="replicated_trans.tdb" try_command_on_node 0 "$CTDB attach $TESTDB replicated" diff --git a/ctdb/tests/INTEGRATION/database/traverse.001.one.sh b/ctdb/tests/INTEGRATION/database/traverse.001.one.sh index 7f3007d5105..1b3b7c2d25c 100755 --- a/ctdb/tests/INTEGRATION/database/traverse.001.one.sh +++ b/ctdb/tests/INTEGRATION/database/traverse.001.one.sh @@ -1,29 +1,17 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <' command from another node to this - node. -5. Verify that the command is not successful since th ctdb daemon is - not running on the node. - -Expected results: - -* The 'ctdb ping' command shows valid and expected output. -EOF -} +#!/usr/bin/env bash + +# Verify the operation of the 'ctdb ping' command +# +# 1. Run the 'ctdb ping' command on one of the nodes and verify that it +# shows valid and expected output. +# 2. Shutdown one of the cluster nodes, using the 'ctdb shutdown' +# command. +# 3. Run the 'ctdb ping -n ' command from another node to this +# node. +# 4. Verify that the command is not successful since th ctdb daemon is +# not running on the node. . "${TEST_SCRIPTS_DIR}/integration.bash" -ctdb_test_init - set -e -cluster_is_healthy +ctdb_test_init try_command_on_node -v 0 "$CTDB ping -n 1" diff --git a/ctdb/tests/INTEGRATION/simple/basics.004.getpid.sh b/ctdb/tests/INTEGRATION/simple/basics.004.getpid.sh index 48540d052b2..27025df9309 100755 --- a/ctdb/tests/INTEGRATION/simple/basics.004.getpid.sh +++ b/ctdb/tests/INTEGRATION/simple/basics.004.getpid.sh @@ -1,34 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <' on the nodes to check the PID of the - ctdbd process. -3. Verify that the output is valid. - -Expected results: - -* 'ctdb getpid' shows valid output. -EOF -} +# Verify that 'ctdb getpid' works as expected . "${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/simple/basics.005.process_exists.sh b/ctdb/tests/INTEGRATION/simple/basics.005.process_exists.sh index ae331bcec33..c6212fda52e 100755 --- a/ctdb/tests/INTEGRATION/simple/basics.005.process_exists.sh +++ b/ctdb/tests/INTEGRATION/simple/basics.005.process_exists.sh @@ -1,39 +1,15 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <' on the node and verify that the - correct output is shown. -4. Run 'ctdb process-exists ' with a pid of ctdb daemon - process and verify that the correct output is shown. +# Verify that 'ctdb process-exists' shows correct information -Expected results: - -* 'ctdb process-exists' shows the correct output. -EOF -} +# The implementation is creative about how it gets PIDs for existing and +# non-existing processes. . "${TEST_SCRIPTS_DIR}/integration.bash" -ctdb_test_init - set -e -cluster_is_healthy +ctdb_test_init test_node=1 srvid=0xAE00000012345678 diff --git a/ctdb/tests/INTEGRATION/simple/basics.010.statistics.sh b/ctdb/tests/INTEGRATION/simple/basics.010.statistics.sh index cda6e5f478e..d97e0353b2e 100755 --- a/ctdb/tests/INTEGRATION/simple/basics.010.statistics.sh +++ b/ctdb/tests/INTEGRATION/simple/basics.010.statistics.sh @@ -1,35 +1,14 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <'. -3. Verify that the status of the node changes to 'DISCONNECTED'. -4. Now run 'ctdb ip -n ' from another node. -5. Verify that an error message is printed stating that the node is - disconnected. -6. Execute some other commands against the shutdown node. For example, - disable, enable, ban, unban, listvars. -7. For each command, verify that an error message is printed stating - that the node is disconnected. - -Expected results: - -* For a node on which ctdb is not running, all commands display an - error message stating that the node is disconnected. -EOF -} +# That is, check that an error message is printed if an attempt is made +# to execute a ctdb command against a node that is not running ctdbd. . "${TEST_SCRIPTS_DIR}/integration.bash" -ctdb_test_init - set -e -cluster_is_healthy +ctdb_test_init test_node=1 diff --git a/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh b/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh index fa934e8bef1..be7175036dc 100755 --- a/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh +++ b/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh @@ -1,11 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <'. - -Expected results: - -* 'ctdb getdebug' shows the debug level on all the nodes. -EOF -} +# Verify that 'ctdb getdebug' works as expected . "${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/simple/debug.002.setdebug.sh b/ctdb/tests/INTEGRATION/simple/debug.002.setdebug.sh index 3e04ca33733..dd5949eec77 100755 --- a/ctdb/tests/INTEGRATION/simple/debug.002.setdebug.sh +++ b/ctdb/tests/INTEGRATION/simple/debug.002.setdebug.sh @@ -1,23 +1,16 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <