ctdb-tests: No longer retry starting the cluster
authorMartin Schwenke <martin@meltin.net>
Tue, 29 Oct 2019 04:11:31 +0000 (15:11 +1100)
committerAmitay Isaacs <amitay@samba.org>
Wed, 6 Nov 2019 01:22:30 +0000 (01:22 +0000)
Retrying like this hides bugs.  The cluster should come up first time,
every time.

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

index d5bd542ab00c30aeecbc23eac02e2447c60b425a..e36af5f9d51cadda39afb122634a1c13fcad7f70 100644 (file)
@@ -568,26 +568,15 @@ wait_until_node_has_no_ips ()
 
 ctdb_init ()
 {
-    local i
-    for i in $(seq 1 5) ; do
        ctdb_stop_all >/dev/null 2>&1 || :
-       ctdb_start_all || {
-           echo "Start failed.  Trying again in a few seconds..."
-           sleep_for 5
-           continue
-       }
 
-       wait_until_ready || {
-           echo "Cluster didn't become ready.  Restarting..."
-           continue
-       }
+       ctdb_start_all || ctdb_test_error "Cluster start failed"
+
+       wait_until_ready || ctdb_test_error "Cluster didn't become ready"
 
        echo "Setting RerecoveryTimeout to 1"
        onnode -pq all "$CTDB setvar RerecoveryTimeout 1"
 
-       # In recent versions of CTDB, forcing a recovery like this
-       # blocks until the recovery is complete.  Hopefully this will
-       # help the cluster to stabilise before a subsequent test.
        echo "Forcing a recovery..."
        onnode -q 0 $CTDB recover
        sleep_for 2
@@ -597,14 +586,8 @@ ctdb_init ()
            wait_until 30/2 onnode -q any $CTDB_TEST_WRAPPER _cluster_is_recovered
        fi
 
-
-       # Cluster is still healthy.  Good, we're done!
        if ! onnode 0 $CTDB_TEST_WRAPPER _cluster_is_healthy ; then
-           echo "Cluster became UNHEALTHY again [$(date)]"
-           onnode -p all ctdb status -X 2>&1
-           onnode -p all ctdb scriptstatus 2>&1
-           echo "Restarting..."
-           continue
+           ctdb_test_error "Cluster became UNHEALTHY again [$(date)]"
        fi
 
        echo "Doing a sync..."
@@ -612,15 +595,6 @@ ctdb_init ()
 
        echo "ctdb is ready"
        return 0
-    done
-
-    echo "Cluster UNHEALTHY...  too many attempts..."
-    onnode -p all ctdb status -X 2>&1
-    onnode -p all ctdb scriptstatus 2>&1
-
-    # Try to make the calling test fail
-    status=1
-    return 1
 }
 
 ctdb_base_show ()