test-handle-redirect-as-used-mirror-change 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. configcompression '.' 'gz'
  8. buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable'
  9. export APT_DONT_SIGN=''
  10. setupaptarchive --no-update
  11. changetowebserver
  12. webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://0.0.0.0:${APTHTTPPORT}/"
  13. rewritesourceslist "http://localhost:${APTHTTPPORT}/redirectme"
  14. testsuccessequal "Get:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease [$(stat -c %s aptarchive/dists/unstable/InRelease) B]
  15. Get:2 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B]
  16. Get:3 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B]
  17. Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
  18. Reading package lists..." aptget update
  19. # ensure we asked the redirector only once
  20. testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease" grep '^Location:' aptarchive/webserver.log
  21. testsuccessequal "Hit:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease
  22. Reading package lists..." aptget update
  23. testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease
  24. Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease" grep '^Location:' aptarchive/webserver.log
  25. rm -rf rootdir/var/lib/apt/lists
  26. testsuccess apt update -o Debug::Acquire::http=1 -o Acquire::SameMirrorForAllIndexes=0
  27. testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease
  28. Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease
  29. Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease
  30. Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/source/Sources.gz
  31. Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.gz
  32. Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.gz" grep '^Location:' aptarchive/webserver.log
  33. cd downloaded
  34. testsuccess apthelper download-file "http://localhost:${APTHTTPPORT}/redirectme/dists/unstable/InRelease" inrelease
  35. testsuccess test -s inrelease
  36. cd - >/dev/null
  37. find aptarchive -name 'InRelease' -delete
  38. rm -rf rootdir/var/lib/apt/lists
  39. testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease
  40. 404 Not Found
  41. Get:2 http://0.0.0.0:${APTHTTPPORT} unstable Release [$(stat -c %s aptarchive/dists/unstable/Release) B]
  42. Get:3 http://0.0.0.0:${APTHTTPPORT} unstable Release.gpg [$(stat -c %s aptarchive/dists/unstable/Release.gpg) B]
  43. Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B]
  44. Get:5 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B]
  45. Get:6 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
  46. Reading package lists..." aptget update
  47. testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease
  48. 404 Not Found
  49. Hit:2 http://0.0.0.0:${APTHTTPPORT} unstable Release
  50. Reading package lists..." aptget update