summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2021-07-29 14:56:41 +0000
committerJulian Andres Klode <jak@debian.org>2021-07-29 14:56:41 +0000
commit410a6d9d84136fc0bc8c50551313c036ae99aafa (patch)
tree4628570893082a286fbde80a1acfa27d4a30c012 /test
parent544d81a26f8c97a2a45262aecbaef4a5b43fb325 (diff)
parent3ca5e18b1f0bb05697ccca7c98ced1176166024a (diff)
Merge branch 'pu/fetch-at' into 'main'
Main-process-side implementation of retry back-off See merge request apt-team/apt!181
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-bug-869859-retry-downloads31
1 files changed, 29 insertions, 2 deletions
diff --git a/test/integration/test-bug-869859-retry-downloads b/test/integration/test-bug-869859-retry-downloads
index 86203f794..4e169b3b9 100755
--- a/test/integration/test-bug-869859-retry-downloads
+++ b/test/integration/test-bug-869859-retry-downloads
@@ -4,6 +4,22 @@ set -e
TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
+testsecondsgreaterequal() {
+ seconds="$1"
+ shift
+ before=$(date +%s)
+ "$@"
+ after=$(date +%s)
+ msggroup 'testsecondsgreaterequal'
+ msgtest "Checking that previous test took more than $secondss"
+ if [ $((after - before)) -lt $seconds ]; then
+ msgfail "Took $((after - before)) second"
+ else
+ msgpass
+ fi
+ msggroup
+}
+
setupenvironment
configarchitecture 'amd64'
@@ -21,12 +37,23 @@ rm -f testpkg_1_all.deb
msgmsg 'Fail after too many retries'
webserverconfig 'aptwebserver::failrequest' '429'
webserverconfig 'aptwebserver::failrequest::pool/testpkg_1_all.deb' '99'
-testfailure apt download testpkg -o acquire::retries=3
+testsecondsgreaterequal 5 testfailureequal "Delaying http://localhost:${APTHTTPPORT} stable/main all testpkg all 1 by 1 seconds
+Ign:1 http://localhost:${APTHTTPPORT} stable/main all testpkg all 1
+ 429 Unknown HTTP code
+Delaying http://localhost:${APTHTTPPORT} stable/main all testpkg all 1 by 2 seconds
+Ign:1 http://localhost:${APTHTTPPORT} stable/main all testpkg all 1
+ 429 Unknown HTTP code
+Delaying http://localhost:${APTHTTPPORT} stable/main all testpkg all 1 by 4 seconds
+Ign:1 http://localhost:${APTHTTPPORT} stable/main all testpkg all 1
+ 429 Unknown HTTP code
+Err:1 http://localhost:${APTHTTPPORT} stable/main all testpkg all 1
+ 429 Unknown HTTP code
+E: Failed to fetch http://localhost:${APTHTTPPORT}/pool/testpkg_1_all.deb 429 Unknown HTTP code" apt download testpkg -o acquire::retries=3 -o debug::acquire::retries=true -q
testfailure test -f testpkg_1_all.deb
msgmsg 'Success in the third try'
webserverconfig 'aptwebserver::failrequest::pool/testpkg_1_all.deb' '2'
-testsuccess apt download testpkg -o acquire::retries=3
+testsuccess apt download testpkg -o acquire::retries=3 -o acquire::retries::delay=false
testsuccess test -f testpkg_1_all.deb
rm -f testpkg_1_all.deb