test-apt-update-ims 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable'
  8. setupaptarchive
  9. changetowebserver
  10. runtest() {
  11. rm -f rootdir/var/lib/apt/lists/localhost*
  12. testsuccess aptget update
  13. # ensure no leftovers in partial
  14. testfailure ls "rootdir/var/lib/apt/lists/partial/*"
  15. # check that I-M-S header is kept in redirections
  16. testequal "$EXPECT" aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0
  17. # ensure that we still do a hash check on ims hit
  18. msgtest 'Test I-M-S reverify'
  19. aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A1 'RecivedHash:' | grep -q -- '- SHA' && msgpass || msgfail
  20. # ensure no leftovers in partial
  21. testfailure ls "rootdir/var/lib/apt/lists/partial/*"
  22. }
  23. msgmsg "InRelease"
  24. EXPECT="Hit http://localhost:8080 unstable InRelease
  25. Hit http://localhost:8080 unstable/main Sources
  26. Hit http://localhost:8080 unstable/main amd64 Packages
  27. Hit http://localhost:8080 unstable/main Translation-en
  28. Reading package lists..."
  29. # with InRelease
  30. runtest
  31. # with gzip
  32. echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
  33. runtest
  34. msgmsg "Release/Release.gpg"
  35. # with Release/Release.gpg
  36. EXPECT="Ign http://localhost:8080 unstable InRelease
  37. 404 Not Found
  38. Hit http://localhost:8080 unstable Release
  39. Hit http://localhost:8080 unstable Release.gpg
  40. Hit http://localhost:8080 unstable/main Sources
  41. Hit http://localhost:8080 unstable/main amd64 Packages
  42. Hit http://localhost:8080 unstable/main Translation-en
  43. Reading package lists..."
  44. find aptarchive -name "InRelease" | xargs rm -f
  45. echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex
  46. runtest
  47. echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
  48. runtest
  49. # no Release.gpg or InRelease
  50. configallowinsecurerepositories "true"
  51. msgmsg "Release only"
  52. EXPECT="Ign http://localhost:8080 unstable InRelease
  53. 404 Not Found
  54. Hit http://localhost:8080 unstable Release
  55. Ign http://localhost:8080 unstable Release.gpg
  56. 404 Not Found
  57. Hit http://localhost:8080 unstable/main Sources
  58. Hit http://localhost:8080 unstable/main amd64 Packages
  59. Hit http://localhost:8080 unstable/main Translation-en
  60. Reading package lists...
  61. W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Packages from that repository can not be authenticated."
  62. find aptarchive -name "Release.gpg" | xargs rm -f
  63. echo 'Acquire::AllowInsecureRepositories "1";' > rootdir/etc/apt/apt.conf.d/insecure.conf
  64. echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex
  65. runtest
  66. echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
  67. runtest