Browse Source

test-network: wait for bootstrap rather than waiting for a set time

Chutney uses the new wait_for_bootstrap feature to start verifying
after bootstrap is complete.

If bootstrap fails, chutney verifies anyway. We'll fail on bootstrap
once we implement 20473.

Closes 28203.
teor 5 years ago
parent
commit
a113d6a46f
2 changed files with 18 additions and 10 deletions
  1. 14 9
      README
  2. 4 1
      tools/test-network-impl.sh

+ 14 - 9
README

@@ -150,18 +150,23 @@ Multiple Tests:
 
 
 Waiting for the network:
 Waiting for the network:
 
 
-  The tools/test-network.sh script waits CHUTNEY_START_TIME seconds
-  (default: 40) before calling chutney verify, because that's the minimum
+  The tools/test-network.sh script waits for all the tor nodes to bootstrap
+  before calling chutney verify. If CHUTNEY_START_TIME is negative, the
+  script leaves the network running, and exits immediately (without waiting
+  for bootstrap, or verifying).
+
+  The wait_for_bootstrap command waits for up to CHUTNEY_START_TIME seconds,
+  checking whether the logged bootstrapped status for every node is 100%. If
+  it is, great: it succeeds. If not, it dumps the bootstrap statuses and
+  exits. test-network.sh does not exit immediately if a tor node fails to
+  bootstrap. Instead, it attempts to verify. We'll add an option to fail on
+  tor bootstrap failure in #20473.
+
+  The default CHUTNEY_START_TIME is 40 seconds, because that's the minimum
   amount of time it takes to bootstrap a consensus containing relays.
   amount of time it takes to bootstrap a consensus containing relays.
   (It takes 20 seconds for the authorities to create the first consensus,
   (It takes 20 seconds for the authorities to create the first consensus,
   then 20 seconds for relays to bootstrap, submit their descriptors, and be
   then 20 seconds for relays to bootstrap, submit their descriptors, and be
-  included in the next consensus.) If CHUTNEY_START_TIME is negative, the
-  script leaves the network running, and exits immediately (without verifying).
-
-  chutney also has an experimental wait_for_bootstrap command. It waits for
-  up to CHUTNEY_START_TIME seconds, checking whether the logged bootstrapped
-  status for every node is 100%. If it is, great: it succeeds. If not, it
-  dumps the bootstrap statuses and exits.
+  included in the next consensus.)
 
 
   Commands like "chutney verify" start immediately, and keep trying for
   Commands like "chutney verify" start immediately, and keep trying for
   CHUTNEY_BOOTSTRAP_TIME seconds (default: 60). If it hasn't been
   CHUTNEY_BOOTSTRAP_TIME seconds (default: 60). If it hasn't been

+ 4 - 1
tools/test-network-impl.sh

@@ -20,7 +20,10 @@ CHUTNEY="$CHUTNEY_PATH/chutney"
 
 
 if [ "$CHUTNEY_START_TIME" -ge 0 ]; then
 if [ "$CHUTNEY_START_TIME" -ge 0 ]; then
     $ECHO "Waiting $CHUTNEY_START_TIME seconds for a consensus containing relays to be generated..."
     $ECHO "Waiting $CHUTNEY_START_TIME seconds for a consensus containing relays to be generated..."
-    sleep "$CHUTNEY_START_TIME"
+    # We log bootstrap status for debugging purposes.
+    # We'll fix bootstrap errors in #20473.
+    "$CHUTNEY" wait_for_bootstrap "$CHUTNEY_NETWORK" \
+        || $ECHO "Tor bootstrap failed, ignoring for now."
 else
 else
     $ECHO "Chutney network launched and running. To stop the network, use:"
     $ECHO "Chutney network launched and running. To stop the network, use:"
     $ECHO "$CHUTNEY stop $CHUTNEY_NETWORK"
     $ECHO "$CHUTNEY stop $CHUTNEY_NETWORK"