ctdb-tests: Separate custom cluster startup from test initialisation
[vlendec/samba-autobuild/.git] / ctdb / tests / scripts / integration.bash
index 61372a44b6051b3e296a1db87a14ece02bedd1c8..b868f6836569a08b5c2c0e68efb422366b439199 100644 (file)
@@ -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 ()