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