test-apt-update-ims 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. EXPECT="Hit http://localhost:8080 unstable InRelease
  24. Hit http://localhost:8080 unstable/main Sources
  25. Hit http://localhost:8080 unstable/main amd64 Packages
  26. Hit http://localhost:8080 unstable/main Translation-en
  27. Reading package lists..."
  28. # with InRelease
  29. runtest
  30. # with gzip
  31. echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
  32. runtest
  33. # FIXME: how can we get rid of this extra line
  34. # "Get:1 http://localhost:8080 unstable Release.gpg"
  35. #
  36. # with Release/Release.gpg
  37. EXPECT="Ign http://localhost:8080 unstable InRelease
  38. Hit http://localhost:8080 unstable Release
  39. Hit http://localhost:8080 unstable Release.gpg
  40. Get:1 http://localhost:8080 unstable Release.gpg
  41. Hit http://localhost:8080 unstable/main Sources
  42. Hit http://localhost:8080 unstable/main amd64 Packages
  43. Hit http://localhost:8080 unstable/main Translation-en
  44. Reading package lists..."
  45. find aptarchive -name "InRelease" | xargs rm -f
  46. echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex
  47. runtest
  48. echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
  49. runtest