summaryrefslogtreecommitdiff
path: root/ctdb/tests/scripts/integration.bash
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/scripts/integration.bash
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/scripts/integration.bash')
-rw-r--r--ctdb/tests/scripts/integration.bash24
1 files changed, 21 insertions, 3 deletions
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 ()