commit e36505fe0c6897403c1363f9562e3967c952cb0a Author: Nick Mathewson nickm@torproject.org Date: Wed Jun 24 11:19:35 2020 -0400
Move wait_for_bootstrap call into bootstrap-network.sh
In order to be able to launch the network in multiple phases, we'll need to launch, wait, launch, wait, etc. --- tools/bootstrap-network.sh | 25 +++++++++++++++++++++++++ tools/test-network-impl.sh | 28 ---------------------------- 2 files changed, 25 insertions(+), 28 deletions(-)
diff --git a/tools/bootstrap-network.sh b/tools/bootstrap-network.sh index a7a5dbe..fd9f7ae 100755 --- a/tools/bootstrap-network.sh +++ b/tools/bootstrap-network.sh @@ -91,3 +91,28 @@ if ! "$CHUTNEY" status "$CHUTNEY_NETWORK"; then sleep 6 CHUTNEY_DEBUG=1 "$CHUTNEY" status "$CHUTNEY_NETWORK" fi + + +# We allow up to CHUTNEY_START_TIME for each bootstrap phase to +# complete. +export CHUTNEY_START_TIME=${CHUTNEY_START_TIME:-120} + +if [ "$CHUTNEY_START_TIME" -ge 0 ]; then + $ECHO "Waiting up to $CHUTNEY_START_TIME seconds for all nodes to bootstrap..." + # We require the network to bootstrap, before we verify + if ! "$CHUTNEY" wait_for_bootstrap "$CHUTNEY_NETWORK"; then + "$DIAGNOSTICS" + CHUTNEY_WARNINGS_IGNORE_EXPECTED=false \ + CHUTNEY_WARNINGS_SUMMARY=false \ + "$WARNING_COMMAND" + "$WARNINGS" + $ECHO "chutney boostrap failed (in wait_for_bootstrap)" + exit 1 + fi +else + $ECHO "Chutney network launched and running. To stop the network, use:" + $ECHO "$CHUTNEY stop $CHUTNEY_NETWORK" + "$DIAGNOSTICS" + "$WARNINGS" + exit 0 +fi diff --git a/tools/test-network-impl.sh b/tools/test-network-impl.sh index afa1c80..b58c6bd 100755 --- a/tools/test-network-impl.sh +++ b/tools/test-network-impl.sh @@ -16,39 +16,11 @@ if ! "$CHUTNEY_PATH/tools/bootstrap-network.sh" "$NETWORK_FLAVOUR"; then exit 1 fi
-# chutney starts verifying after CHUTNEY_START_TIME seconds, -# keeps on trying for CHUTNEY_BOOTSTRAP_TIME seconds, -# and then stops after CHUTNEY_STOP_TIME seconds. -# Even the fastest chutney networks take 5-10 seconds for their first consensus, -# and then 10 seconds after that for relays to bootstrap and upload descriptors, -# and then 10 seconds after that for clients and onion services to bootstrap. -# But chutney defaults to running a bit more slowly, so it is more reliable, -# and we allow a bit more time, in case the machine is heavily loaded. -export CHUTNEY_START_TIME=${CHUTNEY_START_TIME:-120} export CHUTNEY_BOOTSTRAP_TIME=${CHUTNEY_BOOTSTRAP_TIME:-60} export CHUTNEY_STOP_TIME=${CHUTNEY_STOP_TIME:-0}
CHUTNEY="$CHUTNEY_PATH/chutney"
-if [ "$CHUTNEY_START_TIME" -ge 0 ]; then - $ECHO "Waiting up to $CHUTNEY_START_TIME seconds for a consensus containing relays to be generated..." - # We require the network to bootstrap, before we verify - if ! "$CHUTNEY" wait_for_bootstrap "$CHUTNEY_NETWORK"; then - "$DIAGNOSTICS" - CHUTNEY_WARNINGS_IGNORE_EXPECTED=false \ - CHUTNEY_WARNINGS_SUMMARY=false \ - "$WARNING_COMMAND" - "$WARNINGS" - $ECHO "chutney boostrap failed (in wait_for_bootstrap)" - exit 1 - fi -else - $ECHO "Chutney network launched and running. To stop the network, use:" - $ECHO "$CHUTNEY stop $CHUTNEY_NETWORK" - "$DIAGNOSTICS" - "$WARNINGS" - exit 0 -fi
if [ "$CHUTNEY_BOOTSTRAP_TIME" -ge 0 ]; then # Chutney will try to verify for $CHUTNEY_BOOTSTRAP_TIME seconds each round
tor-commits@lists.torproject.org