4 TESTDIR
="$(readlink -f "$(dirname "$0")")"
8 configarchitecture 'i386'
9 configcompression '.' 'gz'
11 insertpackage 'unstable' 'apt' 'i386' '1.0'
13 export APT_DONT_SIGN=''
14 setupaptarchive --no-update
15 cp -a aptarchive/dists aptarchive/dists.good
17 test_inreleasetoobig() {
18 # make InRelease really big to trigger fallback
19 dd if=/dev/zero of=aptarchive/dists/unstable/InRelease bs=1M count=2 2>/dev/null
20 touch -d '+1hour' aptarchive/dists/unstable/InRelease
21 testsuccess aptget update -o Apt::Get::List-Cleanup=0 -o acquire::MaxReleaseFileSize=$((1*1000*1000)) -o Debug::pkgAcquire::worker=0
22 msgtest 'Check that the max write warning is triggered'
23 cp rootdir/tmp/testsuccess.output update.output
24 testsuccess --nomsg grep -q 'Writing more data than expected' update.output
26 # ensure the failed InRelease file got renamed
27 testsuccess ls rootdir/var/lib/apt/lists/partial/*InRelease.FAILED
30 test_packagestoobig() {
31 insertpackage 'unstable' 'foo' 'i386' '1.0'
32 buildaptarchivefromfiles '+1 hour'
34 # append junk at the end of the Packages.gz/Packages
35 SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages.gz)"
36 find aptarchive/dists -name 'Packages*' | while read pkg; do
37 echo "1234567890" >> "$pkg"
38 touch -d '+1hour' "$pkg"
40 NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages.gz)"
41 testfailuremsg "E
: Failed to fetch
${1}/dists
/unstable
/main
/binary
-i386/Packages.gz Writing
more data than expected
($NEW_SIZE > $SIZE)
42 E
: Some index files failed to download. They have been ignored
, or old ones used instead.
" aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::Transaction=0
46 # less complicated test setup this way
47 webserverconfig 'aptwebserver::support::modified-since' 'false' "$1"
48 webserverconfig 'aptwebserver::support::last-modified' 'false' "$1" # curl is clever and sees hits here also
50 msgmsg 'Test with' "$1" 'and clean start'
51 rm -rf rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.good
52 # normal update works fine
53 testsuccess aptget update
54 mv rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.good
56 # starting fresh works
57 test_inreleasetoobig "$1"
58 rm -rf aptarchive/dists rootdir/var/lib/apt/lists
59 cp -a aptarchive/dists.good aptarchive/dists
60 test_packagestoobig "$1"
61 rm -rf aptarchive/dists rootdir/var/lib/apt/lists
62 cp -a aptarchive/dists.good aptarchive/dists
64 msgmsg 'Test with' "$1" 'and existing old data'
65 cp -a rootdir/var/lib/apt/lists.good rootdir/var/lib/apt/lists
66 test_inreleasetoobig "$1"
67 rm -rf aptarchive/dists rootdir/var/lib/apt/lists
68 cp -a rootdir/var/lib/apt/lists.good rootdir/var/lib/apt/lists
69 cp -a aptarchive/dists.good aptarchive/dists
70 test_packagestoobig "$1"
71 rm -rf aptarchive/dists
72 cp -a aptarchive/dists.good aptarchive/dists
76 methodtest "http
://localhost
:${APTHTTPPORT}"
78 changetohttpswebserver
79 methodtest "https
://localhost
:${APTHTTPSPORT}"