commit a113d6a46f63d70f84afa3adc4f3baab2ed414f0 Author: teor teor@torproject.org Date: Wed Mar 13 13:24:29 2019 +1000
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. --- README | 23 ++++++++++++++--------- tools/test-network-impl.sh | 5 ++++- 2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/README b/README index 28f90a0..d2bcfad 100644 --- a/README +++ b/README @@ -150,18 +150,23 @@ Multiple Tests:
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. (It takes 20 seconds for the authorities to create the first consensus, 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 CHUTNEY_BOOTSTRAP_TIME seconds (default: 60). If it hasn't been diff --git a/tools/test-network-impl.sh b/tools/test-network-impl.sh index 2de1bfa..ca086df 100755 --- a/tools/test-network-impl.sh +++ b/tools/test-network-impl.sh @@ -20,7 +20,10 @@ CHUTNEY="$CHUTNEY_PATH/chutney"
if [ "$CHUTNEY_START_TIME" -ge 0 ]; then $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 $ECHO "Chutney network launched and running. To stop the network, use:" $ECHO "$CHUTNEY stop $CHUTNEY_NETWORK"