tests/integration: Update daemons shutdown pseudo-test
authorMartin Schwenke <martin@meltin.net>
Fri, 29 Nov 2013 03:05:49 +0000 (14:05 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Mon, 31 Mar 2014 02:38:16 +0000 (13:38 +1100)
Don't scatter the TEST_LOCAL_DAEMONS logic around the code.  Limit it
to the local daemons file.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
(Imported from commit f05db5edc434da61bc7cd7233c5b9cb61cd888bf)

tests/scripts/integration.bash
tests/simple/99_daemons_shutdown.sh
tests/simple/scripts/local_daemons.bash

index 791638e3b83c3549f437e43c15f11097d1f014e7..2e213ace3bfc78aff3d9c657c6ca0cf73e19c7b1 100644 (file)
@@ -571,6 +571,12 @@ restart_ctdb ()
     return 1
 }
 
+# Does nothing on cluster and should be overridden for local daemons
+maybe_stop_ctdb ()
+{
+    :
+}
+
 ctdb_restart_when_done ()
 {
     ctdb_test_restart_scheduled=true
index 3583828b71aef855452ed6919f829a61e5035d74..42ea1f4031c34c4f3ce0739b213db65baf5480f9 100755 (executable)
@@ -18,6 +18,6 @@ EOF
 # Do not call ctdb_test_init() here.  It will setup ctdb_test_exit()
 # to run and that will find the daemons missing and restart them!
 
-if [ -n "$TEST_LOCAL_DAEMONS" ] && $TEST_CLEANUP ; then
-    daemons_stop
-fi
+# We only want to consider stopping CTDB if we're running local
+# daemons.  This function will do the right thing.
+maybe_stop_ctdb
index f34eff0bd6541b10c48e858cac3c30904c8cf233..10a1c5a84a50ed0103d808fd50d1eb1c68564b57 100644 (file)
@@ -121,3 +121,10 @@ daemons_start ()
        daemons_start_1 $i "$@"
     done
 }
+
+maybe_stop_ctdb ()
+{
+    if $TEST_CLEANUP ; then
+       daemons_stop
+    fi
+}