summaryrefslogtreecommitdiff
path: root/ctdb/tests
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2019-12-10 14:44:45 +1100
committerAmitay Isaacs <amitay@samba.org>2020-07-22 02:42:38 +0000
commite9df17b500146e62539feac66d0cd4b3ef7aa47a (patch)
tree4887d7157554547db9cfc34e6cb02c2b5c850740 /ctdb/tests
parent44e05ac8515be3220a334ae8001db83b06bec59f (diff)
downloadsamba-e9df17b500146e62539feac66d0cd4b3ef7aa47a.tar.gz
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@meltin.net>
Diffstat (limited to 'ctdb/tests')
-rwxr-xr-xctdb/tests/INTEGRATION/failover/pubips.013.failover_noop.sh10
-rwxr-xr-xctdb/tests/INTEGRATION/simple/cluster.012.reclock_command.sh6
-rwxr-xr-xctdb/tests/INTEGRATION/simple/eventscripts.001.zero_scripts.sh4
-rw-r--r--ctdb/tests/scripts/integration.bash24
4 files changed, 30 insertions, 14 deletions
diff --git a/ctdb/tests/INTEGRATION/failover/pubips.013.failover_noop.sh b/ctdb/tests/INTEGRATION/failover/pubips.013.failover_noop.sh
index 1c13a3ce3c2..488243d6260 100755
--- a/ctdb/tests/INTEGRATION/failover/pubips.013.failover_noop.sh
+++ b/ctdb/tests/INTEGRATION/failover/pubips.013.failover_noop.sh
@@ -11,10 +11,10 @@ set -e
ctdb_test_skip_on_cluster
-echo "Starting CTDB with failover disabled..."
-ctdb_test_init -F
+ctdb_test_init -n
-cluster_is_healthy
+echo "Starting CTDB with failover disabled..."
+ctdb_nodes_start_custom -F
echo "Getting IP allocation..."
try_command_on_node -v any "$CTDB ip all | tail -n +2"
@@ -30,9 +30,7 @@ echo "GOOD: All IP addresses are unassigned"
echo "----------------------------------------"
echo "Starting CTDB with an empty public addresses configuration..."
-ctdb_test_init -P /dev/null
-
-cluster_is_healthy
+ctdb_nodes_start_custom -P /dev/null
echo "Trying explicit ipreallocate..."
try_command_on_node any $CTDB ipreallocate
diff --git a/ctdb/tests/INTEGRATION/simple/cluster.012.reclock_command.sh b/ctdb/tests/INTEGRATION/simple/cluster.012.reclock_command.sh
index 76be340d7cb..d043c7e2615 100755
--- a/ctdb/tests/INTEGRATION/simple/cluster.012.reclock_command.sh
+++ b/ctdb/tests/INTEGRATION/simple/cluster.012.reclock_command.sh
@@ -12,9 +12,9 @@ set -e
ctdb_test_skip_on_cluster
-echo "Starting CTDB with recovery lock command configured..."
-ctdb_test_init -R
+ctdb_test_init -n
-cluster_is_healthy
+echo "Starting CTDB with recovery lock command configured..."
+ctdb_nodes_start_custom -R
echo "Good, that seems to work!"
diff --git a/ctdb/tests/INTEGRATION/simple/eventscripts.001.zero_scripts.sh b/ctdb/tests/INTEGRATION/simple/eventscripts.001.zero_scripts.sh
index fb1d031e982..4fdf61cee2d 100755
--- a/ctdb/tests/INTEGRATION/simple/eventscripts.001.zero_scripts.sh
+++ b/ctdb/tests/INTEGRATION/simple/eventscripts.001.zero_scripts.sh
@@ -9,8 +9,8 @@ set -e
ctdb_test_skip_on_cluster
-ctdb_test_init --no-event-scripts
+ctdb_test_init -n
-cluster_is_healthy
+ctdb_nodes_start_custom --no-event-scripts
echo "Good, that seems to work!"
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index 2798d61f736..aa1554ee318 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -88,19 +88,37 @@ ctdb_test_cleanup_pid_clear ()
ctdb_test_cleanup_pid=""
}
+# -n option means do not configure/start cluster
ctdb_test_init ()
{
trap "ctdb_test_exit" 0
ctdb_nodes_stop >/dev/null 2>&1 || true
+ if [ "$1" != "-n" ] ; then
+ echo "Configuring cluster..."
+ setup_ctdb || ctdb_test_error "Cluster configuration failed"
+
+ echo "Starting cluster..."
+ ctdb_init || ctdb_test_error "Cluster startup failed"
+ fi
+
+ echo "*** SETUP COMPLETE AT $(date '+%F %T'), RUNNING TEST..."
+}
+
+ctdb_nodes_start_custom ()
+{
+ if ctdb_test_on_cluster ; then
+ ctdb_test_error "ctdb_nodes_start_custom() on real cluster"
+ fi
+
+ ctdb_nodes_stop >/dev/null 2>&1 || true
+
echo "Configuring cluster..."
setup_ctdb "$@" || ctdb_test_error "Cluster configuration failed"
echo "Starting cluster..."
- ctdb_init || ctdb_test_error "Cluster startup failed"
-
- echo "*** SETUP COMPLETE AT $(date '+%F %T'), RUNNING TEST..."
+ ctdb_init || ctdb_test_fail "Cluster startup failed"
}
ctdb_test_skip_on_cluster ()