]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-update-expected-size
test/integration/test-apt-update-filesize-mismatch: use "basename file suffix" instea...
[apt.git] / test / integration / test-apt-update-expected-size
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6
7 setupenvironment
8 configarchitecture "i386"
9
10 insertpackage 'unstable' 'apt' 'all' '1.0'
11
12 setupaptarchive --no-update
13 changetowebserver
14
15 # normal update works fine
16 testsuccess aptget update
17
18 # make InRelease really big to trigger fallback
19 mv aptarchive/dists/unstable/InRelease aptarchive/dists/unstable/InRelease.good
20 dd if=/dev/zero of=aptarchive/dists/unstable/InRelease bs=1M count=2 2>/dev/null
21 touch -d '+1hour' aptarchive/dists/unstable/InRelease
22 testsuccess aptget update -o Apt::Get::List-Cleanup=0 -o acquire::MaxReleaseFileSize=$((1*1000*1000)) -o Debug::pkgAcquire::worker=0
23 msgtest 'Check that the max write warning is triggered'
24 if grep -q "Writing more data than expected" rootdir/tmp/testsuccess.output; then
25 msgpass
26 else
27 cat rootdir/tmp/testsuccess.output
28 msgfail
29 fi
30 # ensure the failed InRelease file got renamed
31 testsuccess ls rootdir/var/lib/apt/lists/partial/*InRelease.FAILED
32 mv aptarchive/dists/unstable/InRelease.good aptarchive/dists/unstable/InRelease
33
34
35 # append junk at the end of the Packages.gz/Packages
36 SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"
37 find aptarchive -name 'Packages*' | while read pkg; do
38 echo "1234567890" >> "$pkg"
39 done
40 NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"
41 rm -f rootdir/var/lib/apt/lists/localhost*
42 testequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE)
43
44 E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq