ctdb-tests: Check that no IPs are assigned when failover is disabled
authorMartin Schwenke <martin@meltin.net>
Fri, 24 Aug 2018 07:37:38 +0000 (17:37 +1000)
committerKarolin Seeger <kseeger@samba.org>
Tue, 28 Aug 2018 08:59:17 +0000 (10:59 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Aug 24 14:13:12 CEST 2018 on sn-devel-144

(cherry picked from commit 6fb80cbffb9cb8cba6abc3fbce228811d36e8c9a)

ctdb/tests/simple/19_ip_takeover_noop.sh
ctdb/tests/simple/scripts/local_daemons.bash

index af0cdee383bf04fc9129628bebdb41e9e369cd3a..0b86241db2a8480d81fe6050eff3343c14556b9f 100755 (executable)
@@ -3,7 +3,10 @@
 test_info()
 {
     cat <<EOF
-Check that CTDB operates correctly if there are 0 public IPs configured
+Check that CTDB operates correctly if:
+
+* failover is disabled; or
+* there are 0 public IPs configured
 
 This test only does anything with local daemons.  On a real cluster it
 has no way of updating configuration.
@@ -30,6 +33,28 @@ select_test_node_and_ips
 
 daemons_stop
 
+echo "Starting CTDB with failover disabled..."
+setup_ctdb --disable-failover
+daemons_start
+
+wait_until_ready
+
+echo "Getting IP allocation..."
+try_command_on_node -v any "$CTDB ip all | tail -n +2"
+
+while read ip pnn ; do
+       if [ "$pnn" != "-1" ] ; then
+               die "BAD: IP address ${ip} is assigned to node ${pnn}"
+       fi
+done <<EOF
+$out
+EOF
+
+echo "GOOD: All IP addresses are unassigned"
+
+echo "----------------------------------------"
+daemons_stop
+
 echo "Starting CTDB with an empty public addresses configuration..."
 setup_ctdb --no-public-addresses
 daemons_start
index dd383cf628908f13cbc27cfa8f11e49e9f88b2f5..c7a5ee05fc62a1fb9fd331a716aa3fd636108e95 100644 (file)
@@ -94,9 +94,11 @@ setup_ctdb ()
 {
        local no_public_addresses=false
        local no_event_scripts=false
+       local disable_failover=false
        case "$1" in
        --no-public-addresses) no_public_addresses=true ;;
        --no-event-scripts)    no_event_scripts=true    ;;
+       --disable-failover)    disable_failover=true    ;;
        esac
 
        nodes_file="${SIMPLE_TESTS_VAR_DIR}/nodes"
@@ -154,6 +156,9 @@ setup_ctdb ()
        persistent database directory = ${db_dir}/persistent
        state database directory = ${db_dir}/state
 
+[failover]
+       disabled = ${disable_failover}
+
 [event]
        debug script = debug-hung-script.sh
 EOF