test-apt-update-ims 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. Hit http://localhost:8080 unstable Release
  38. Hit http://localhost:8080 unstable Release.gpg
  39. Hit http://localhost:8080 unstable/main Sources
  40. Hit http://localhost:8080 unstable/main amd64 Packages
  41. Hit http://localhost:8080 unstable/main Translation-en
  42. Reading package lists..."
  43. find aptarchive -name "InRelease" | xargs rm -f
  44. echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex
  45. runtest
  46. echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
  47. runtest
  48. # no Release.gpg or InRelease
  49. msgmsg "Release only"
  50. EXPECT="Ign http://localhost:8080 unstable InRelease
  51. Hit http://localhost:8080 unstable Release
  52. Ign http://localhost:8080 unstable Release.gpg
  53. Hit http://localhost:8080 unstable/main Sources
  54. Hit http://localhost:8080 unstable/main amd64 Packages
  55. Hit http://localhost:8080 unstable/main Translation-en
  56. Reading package lists..."
  57. find aptarchive -name "Release.gpg" | xargs rm -f
  58. echo 'Acquire::AllowInsecureRepositories "1";' > rootdir/etc/apt/apt.conf.d/insecure.conf
  59. echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex
  60. runtest
  61. echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
  62. runtest