test-apt-update-expected-size 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture "i386"
  7. insertpackage 'unstable' 'apt' 'all' '1.0'
  8. setupaptarchive --no-update
  9. changetowebserver
  10. # normal update works fine
  11. testsuccess aptget update
  12. # make InRelease really big
  13. mv aptarchive/dists/unstable/InRelease aptarchive/dists/unstable/InRelease.good
  14. dd if=/dev/zero of=aptarchive/dists/unstable/InRelease bs=1M count=2
  15. touch -d '+1hour' aptarchive/dists/unstable/InRelease
  16. aptget update -o acquire::MaxReleaseFileSize=$((1*1000*1000))
  17. # append junk at the end of the Packages.gz/Packages
  18. SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"
  19. echo "1234567890" >> aptarchive/dists/unstable/main/binary-i386/Packages.gz
  20. echo "1234567890" >> aptarchive/dists/unstable/main/binary-i386/Packages
  21. NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"
  22. rm -f rootdir/var/lib/apt/lists/localhost*
  23. testequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE) [IP: ::1 8080]
  24. E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq