test-apt-update-unauth 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/sh
  2. #
  3. # Ensure that when going from unauthenticated to authenticated all
  4. # files are checked again
  5. #
  6. set -e
  7. TESTDIR=$(readlink -f $(dirname $0))
  8. . $TESTDIR/framework
  9. setupenvironment
  10. configarchitecture "i386"
  11. insertpackage 'unstable' 'foo' 'all' '1.0'
  12. insertsource 'unstable' 'foo' 'all' '1.0'
  13. setupaptarchive
  14. changetowebserver
  15. # FIXME:
  16. # - also check the unauth -> auth success case, i.e. that all files are
  17. # reverified
  18. runtest() {
  19. # start unauthenticated
  20. find rootdir/var/lib/apt/lists/ -type f | xargs rm -f
  21. rm -f aptarchive/dists/unstable/*Release*
  22. # remove uncompressed version
  23. find aptarchive/ -name Packages | xargs rm -f
  24. aptget update -qq
  25. # become authenticated
  26. generatereleasefiles
  27. signreleasefiles
  28. # and ensure we re-check the downloaded data
  29. msgtest "Check rollback on going from unauth -> auth"
  30. # change the local packages file
  31. PKGS=$(ls rootdir/var/lib/apt/lists/*Packages*)
  32. echo "meep" > $PKGS
  33. ls -l rootdir/var/lib/apt/lists > lists.before
  34. # update and ensure all is reverted on the hashsum failure
  35. aptget update -o Debug::Acquire::Transaction=1 -o Debug::pkgAcquire::Auth=1 -o Debug::pkgAcquire::worker=0 > output.log 2>&1 || true
  36. # ensure we have before what we have after
  37. ls -l rootdir/var/lib/apt/lists > lists.after
  38. if diff -u lists.before lists.after; then
  39. msgpass
  40. else
  41. #cat output.log
  42. msgfail
  43. fi
  44. }
  45. for COMPRESSEDINDEXES in 'false' 'true'; do
  46. echo "Acquire::GzipIndexes \"$COMPRESSEDINDEXES\";" > rootdir/etc/apt/apt.conf.d/compressindexes
  47. if $COMPRESSEDINDEXES; then
  48. msgmsg 'Run tests with GzipIndexes enabled'
  49. else
  50. msgmsg 'Run tests with GzipIndexes disabled'
  51. fi
  52. runtest
  53. done