You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test-bug-869859-retry-downloads 1.8 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. buildsimplenativepackage 'testpkg' 'all' '1' 'stable'
  8. setupaptarchive --no-update
  9. changetowebserver
  10. testsuccess apt update
  11. cd downloaded
  12. testsuccess apt download testpkg
  13. testsuccess test -f testpkg_1_all.deb
  14. rm -f testpkg_1_all.deb
  15. msgmsg 'Fail after too many retries'
  16. webserverconfig 'aptwebserver::failrequest' '429'
  17. webserverconfig 'aptwebserver::failrequest::pool/testpkg_1_all.deb' '99'
  18. testfailure apt download testpkg -o acquire::retries=3
  19. testfailure test -f testpkg_1_all.deb
  20. msgmsg 'Success in the third try'
  21. webserverconfig 'aptwebserver::failrequest::pool/testpkg_1_all.deb' '2'
  22. testsuccess apt download testpkg -o acquire::retries=3
  23. testsuccess test -f testpkg_1_all.deb
  24. rm -f testpkg_1_all.deb
  25. msgmsg 'Do not try everything again, hard failures keep hard failures'
  26. webserverconfig 'aptwebserver::failrequest' '404'
  27. webserverconfig 'aptwebserver::failrequest::pool/testpkg_1_all.deb' '2'
  28. testfailure apt download testpkg -o acquire::retries=3
  29. testfailure test -f testpkg_1_all.deb
  30. cat ../rootdir/etc/apt/sources.list.d/apt-test-*.list > ../rootdir/etc/apt/sources.list.d/00http-source.list
  31. changetohttpswebserver
  32. msgmsg 'Check download from alternative sources if first failed'
  33. webserverconfig 'aptwebserver::failrequest::pool/testpkg_1_all.deb' '0'
  34. testsuccess apt update
  35. testsuccess apt download testpkg -o acquire::retries=0
  36. testsuccess test -f testpkg_1_all.deb
  37. rm -f testpkg_1_all.deb
  38. # we make the first source fail by disabling http support
  39. webserverconfig 'aptwebserver::support::http' 'false'
  40. testsuccess apt download testpkg -o acquire::retries=0
  41. cp ../rootdir/tmp/testsuccess.output alt.output
  42. testsuccess grep '^ 400 Bad Request' alt.output
  43. testsuccess test -f testpkg_1_all.deb
  44. rm -f testpkg_1_all.deb