From 337dedcad48eaa195dd75b6d16b86239fd4f4a9a Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Sun, 17 Nov 2024 10:36:10 +0000 Subject: [PATCH] tests: Increase retries on the external tests The external tests are heavily dependent on the testing environment, because they reach out to live external resolvers. Because of it, they are quite sensitive to transient failures, and this is often experienced as flakiness in the Github CI. To make these less flaky, this patch increases the retries, with incremental delay between each attempt. --- tests/external.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/external.sh b/tests/external.sh index 1e87c59..0e601ea 100755 --- a/tests/external.sh +++ b/tests/external.sh @@ -227,15 +227,23 @@ do echo "## DoH against $server" dnss -enable_dns_to_https -dns_listen_addr "localhost:1053" \ -https_upstream "$server" - # Retry once after giving it some time, because the test environment - # and/or the server may be flaky. - if ! resolve; then - echo - echo "### Retrying in 1s" - sleep 1 - resolve - fi + + # Retry a few times with some delay in between, because the test + # environment and/or the server may be flaky. + success=0 + for delay_sec in 0 1 3 5 10; do + sleep $delay_sec + if resolve; then + success=1 + break + fi + done + kill $PID + if [ "$success" -ne 1 ]; then + echo "Failed to resolve with upstream $server" + exit 1 + fi done