From: Martin Schwenke Date: Mon, 8 Oct 2018 02:30:55 +0000 (+1100) Subject: ctdb-tests: Start daemons in ctdb_test_init(), stop them in ctdb_test_exit() X-Git-Tag: tdb-1.3.17~887 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e9ead8f28fced3ebfa888786a1dc5bb59e734a3;p=thirdparty%2Fsamba.git ctdb-tests: Start daemons in ctdb_test_init(), stop them in ctdb_test_exit() This makes tests self-contained. They can also now be individually looped, if necessary. Most tests (all but 1 complex, more than 50% of simple) restart the daemons anyway, so this simplification is worth it. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash index 25363d3c194..fdfa714fe87 100644 --- a/ctdb/tests/scripts/integration.bash +++ b/ctdb/tests/scripts/integration.bash @@ -44,22 +44,8 @@ ctdb_test_exit () eval "$ctdb_test_exit_hook" || true unset ctdb_test_exit_hook - if $ctdb_test_restart_scheduled || ! cluster_is_healthy ; then - echo "Restarting CTDB (scheduled)..." - ctdb_stop_all || true # Might be restarting some daemons were shutdown - - echo "Reconfiguring cluster..." - setup_ctdb - - ctdb_init - else - # This could be made unconditional but then we might get - # duplication from the recovery in ctdb_init(). We want to - # leave the recovery in ctdb_init() so that future tests that - # might do a manual restart mid-test will benefit. - echo "Forcing a recovery..." - onnode 0 $CTDB recover - fi + echo "Stopping cluster..." + ctdb_stop_all exit $status } @@ -71,9 +57,19 @@ ctdb_test_exit_hook_add () ctdb_test_init () { - ctdb_test_restart_scheduled=false + ctdb_test_restart_scheduled=false + + trap "ctdb_test_exit" 0 + + ctdb_stop_all >/dev/null 2>&1 || true + + echo "Configuring cluster..." + setup_ctdb || exit 1 + + echo "Starting cluster..." + ctdb_init || exit 1 - trap "ctdb_test_exit" 0 + echo "*** SETUP COMPLETE AT $(date '+%F %T'), RUNNING TEST..." } ########################################