test-apt-update-not-modified 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture 'amd64' 'i386'
  7. insertpackage 'unstable' 'apt' 'all' '1.0'
  8. setupaptarchive --no-update
  9. methodtest() {
  10. msgmsg 'Test with' "$1"
  11. rm -rf rootdir/var/lib/apt/lists
  12. # get our cache populated
  13. testsuccess aptget update
  14. listcurrentlistsdirectory > listsdir.lst
  15. # hit again with a good cache
  16. testsuccessequal "Hit $1 unstable InRelease
  17. Reading package lists..." aptget update
  18. testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
  19. # drop an architecture, which means the file should be gone now
  20. configarchitecture 'i386'
  21. sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
  22. testsuccessequal "Hit $1 unstable InRelease
  23. Reading package lists..." aptget update
  24. testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
  25. # readd arch so its downloaded again
  26. configarchitecture 'amd64' 'i386'
  27. testsuccessequal "Hit $1 unstable InRelease
  28. Get:1 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
  29. Reading package lists..." aptget update
  30. testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
  31. }
  32. changetowebserver
  33. methodtest 'http://localhost:8080'
  34. changetohttpswebserver
  35. methodtest 'https://localhost:4433'