You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

46 lines
1.6 KiB

  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 2>/dev/null
  15. touch -d '+1hour' aptarchive/dists/unstable/InRelease
  16. aptget update -o Apt::Get::List-Cleanup=0 -o acquire::MaxReleaseFileSize=$((1*1000*1000)) -o Debug::pkgAcquire::worker=0 > output.log
  17. msgtest 'Check that the max write warning is triggered'
  18. if grep -q "Writing more data than expected" output.log; then
  19. msgpass
  20. else
  21. cat output.log
  22. msgfail
  23. fi
  24. # ensure the failed InRelease file got renamed
  25. testsuccess ls rootdir/var/lib/apt/lists/partial/*InRelease.FAILED
  26. mv aptarchive/dists/unstable/InRelease.good aptarchive/dists/unstable/InRelease
  27. # append junk at the end of the Packages.gz/Packages
  28. SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"
  29. find aptarchive -name 'Packages*' | while read pkg; do
  30. echo "1234567890" >> "$pkg"
  31. done
  32. NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"
  33. rm -f rootdir/var/lib/apt/lists/localhost*
  34. testequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE)
  35. E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq