test-apt-update-ims 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 --no-update
  9. changetowebserver
  10. runtest() {
  11. configallowinsecurerepositories "${1:-false}"
  12. rm -f rootdir/var/lib/apt/lists/localhost*
  13. if [ "$1" = 'true' ]; then
  14. testwarning aptget update
  15. else
  16. testsuccess aptget update
  17. fi
  18. # ensure no leftovers in partial
  19. testfailure ls "rootdir/var/lib/apt/lists/partial/*"
  20. # check that I-M-S header is kept in redirections
  21. testequal "$EXPECT" aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0
  22. # ensure that we still do a hash check on ims hit
  23. msgtest 'Test I-M-S' 'reverify'
  24. aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A2 'ReceivedHash:' | grep -q -- '- SHA' && msgpass || msgfail
  25. # ensure no leftovers in partial
  26. testfailure ls "rootdir/var/lib/apt/lists/partial/*"
  27. }
  28. msgmsg "InRelease"
  29. EXPECT="Hit http://localhost:8080 unstable InRelease
  30. Hit http://localhost:8080 unstable/main Sources
  31. Hit http://localhost:8080 unstable/main amd64 Packages
  32. Hit http://localhost:8080 unstable/main Translation-en
  33. Reading package lists..."
  34. # with InRelease
  35. runtest
  36. # with gzip
  37. echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
  38. runtest
  39. msgmsg "Release/Release.gpg"
  40. # with Release/Release.gpg
  41. EXPECT="Ign http://localhost:8080 unstable InRelease
  42. 404 Not Found
  43. Hit http://localhost:8080 unstable Release
  44. Hit http://localhost:8080 unstable Release.gpg
  45. Hit http://localhost:8080 unstable/main Sources
  46. Hit http://localhost:8080 unstable/main amd64 Packages
  47. Hit http://localhost:8080 unstable/main Translation-en
  48. Reading package lists..."
  49. find aptarchive -name 'InRelease' -delete
  50. echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex
  51. runtest
  52. echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
  53. runtest
  54. # no Release.gpg or InRelease
  55. msgmsg "Release only"
  56. EXPECT="Ign http://localhost:8080 unstable InRelease
  57. 404 Not Found
  58. Hit http://localhost:8080 unstable Release
  59. Ign http://localhost:8080 unstable Release.gpg
  60. 404 Not Found
  61. Hit http://localhost:8080 unstable/main Sources
  62. Hit http://localhost:8080 unstable/main amd64 Packages
  63. Hit http://localhost:8080 unstable/main Translation-en
  64. Reading package lists...
  65. W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Packages from that repository can not be authenticated."
  66. find aptarchive -name 'Release.gpg' -delete
  67. echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex
  68. runtest "true"
  69. echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
  70. runtest "true"