ctdb-tests: Add some options to setup_ctdb()
authorMartin Schwenke <martin@meltin.net>
Fri, 23 Feb 2018 01:05:14 +0000 (12:05 +1100)
committerAmitay Isaacs <amitay@samba.org>
Mon, 19 Mar 2018 01:23:18 +0000 (02:23 +0100)
These provide special-purpose setups for particular testcases.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/simple/scripts/local_daemons.bash

index b9b6232bbe8720cdd3f8c90723141e6fe8d03656..09898707e03e0a2495642ddae3459d3f81931ea9 100644 (file)
@@ -134,6 +134,13 @@ setup_public_addresses ()
 
 setup_ctdb ()
 {
+       local no_public_addresses=false
+       local no_event_scripts=false
+       case "$1" in
+       --no-public-addresses) no_public_addresses=true ;;
+       --no-event-scripts)    no_event_scripts=true    ;;
+       esac
+
        setup_nodes >"$CTDB_NODES" || return 1
 
        # If there are (strictly) greater than 2 nodes then we'll
@@ -159,7 +166,7 @@ setup_ctdb ()
 
                local public_addresses="${node_dir}/public_addresses"
 
-               if  [ $pnn_no_ips -eq $pnn ] ; then
+               if  $no_public_addresses || [ $pnn_no_ips -eq $pnn ] ; then
                        echo "Node ${pnn} will have no public IPs."
                        : >"$public_addresses"
                else
@@ -173,6 +180,10 @@ setup_ctdb ()
                local db_dir="${node_dir}/db"
                mkdir -p "${db_dir}/persistent"
 
+               if $no_event_scripts ; then
+                       rm -vf "${CTDB_BASE}/events.d/"*
+               fi
+
                cat >"$conf" <<EOF
 CTDB_RECOVERY_LOCK="${SIMPLE_TESTS_VAR_DIR}/rec.lock"
 CTDB_NODES="$CTDB_NODES"