ctdb-daemon: Add testing environment variable CTDB_TEST_MODE
authorMartin Schwenke <martin@meltin.net>
Thu, 5 Apr 2018 05:37:42 +0000 (15:37 +1000)
committerMartin Schwenke <martins@samba.org>
Tue, 1 May 2018 11:31:18 +0000 (13:31 +0200)
This is a generic indicator that tests are being run.

For local daemons, this will replace --sloppy-start and
--nopublicipcheck - it also does --nosetsched, which isn't being
removed at this point.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdbd.c
ctdb/tests/README
ctdb/tests/run_tests.sh

index 021fe907d8f55e5262d3a8cc77041dfdaae782dd..9c9e84e686c4b3d6965a876d7fb689f2a8ca0c82 100644 (file)
@@ -140,6 +140,7 @@ int main(int argc, const char *argv[])
        poptContext pc;
        struct tevent_context *ev;
        const char *ctdb_base;
+       const char *t;
 
        /* Environment variable overrides default */
        ctdbd_pidfile = getenv("CTDB_PIDFILE");
@@ -326,6 +327,13 @@ int main(int argc, const char *argv[])
 
        ctdb->do_checkpublicip = (options.no_publicipcheck == 0);
 
+       t = getenv("CTDB_TEST_MODE");
+       if (t != NULL) {
+               ctdb->do_setsched = false;
+               ctdb->do_checkpublicip = false;
+               fast_start = true;
+       }
+
        if (options.max_persistent_check_errors < 0) {
                ctdb->max_persistent_check_errors = 0xFFFFFFFFFFFFFFFFLL;
        } else {
index 92b637ae7681b6b994c2bc9c06ef9b4f37eacc99..c9eec4d48ba65e617ceadad444c9299960002538 100644 (file)
@@ -120,3 +120,20 @@ How is the ctdb tool invoked?
 $CTDB determines how to invoke the ctdb client.  If not already set
 and if $VALGRIND is set, this is set to "$VALGRIND ctdb".  If this is
 not already set but $VALGRIND is not set, this is simply set to "ctdb"
+
+Test and debugging variable options
+-----------------------------------
+
+       CTDB_TEST_MODE
+
+          Set this environment variable to enable test mode.
+
+          When testing with multiple local daemons on a single
+          machine this does 3 things:
+
+          * Disables checks related to public IP addresses
+
+          * Speeds up the initial recovery during startup at the
+            expense of some consistency checking
+
+          * Disables real-time scheduling
index a7ca44e863eeb4c3e59708d0c0a5b1f5613c7489..3649d76e34e13c2b0c65d1179badd0c577f12f37 100755 (executable)
@@ -235,6 +235,8 @@ find_and_run_one_test ()
     fi
 }
 
+export CTDB_TEST_MODE="yes"
+
 # Following 2 lines may be modified by installation script
 export CTDB_TESTS_ARE_INSTALLED=false
 export CTDB_TEST_DIR=$(dirname "$0")