4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
"i386"
10 insertpackage
'unstable' 'apt' 'all' '1.0'
12 setupaptarchive
--no-update
13 cp -a aptarchive
/dists aptarchive
/dists.good
15 test_inreleasetoobig
() {
16 # make InRelease really big to trigger fallback
17 dd if=/dev
/zero of
=aptarchive
/dists
/unstable
/InRelease bs
=1M count
=2 2>/dev
/null
18 touch -d '+1hour' aptarchive
/dists
/unstable
/InRelease
19 testsuccess aptget update
-o Apt
::Get
::List
-Cleanup=0 -o acquire
::MaxReleaseFileSize
=$((1*1000*1000)) -o Debug
::pkgAcquire
::worker
=0
20 msgtest
'Check that the max write warning is triggered'
21 cp rootdir
/tmp
/testsuccess.output update.output
22 testsuccess
--nomsg grep -q 'Writing more data than expected' update.output
24 # ensure the failed InRelease file got renamed
25 testsuccess
ls rootdir
/var
/lib
/apt
/lists
/partial
/*InRelease.FAILED
28 test_packagestoobig
() {
29 redatereleasefiles
'+1hour'
30 # append junk at the end of the Packages.gz/Packages
31 SIZE
="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"
32 find aptarchive
/dists
-name 'Packages*' | while read pkg
; do
33 echo "1234567890" >> "$pkg"
34 touch -d '+1hour' "$pkg"
36 NEW_SIZE
="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"
37 testfailuremsg
"W: Failed to fetch ${1}/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE)
38 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
42 # less complicated test setup this way
43 webserverconfig
'aptwebserver::support::modified-since' 'false' "$1"
44 webserverconfig
'aptwebserver::support::last-modified' 'false' "$1" # curl is clever and sees hits here also
46 msgmsg
'Test with' "$1" 'and clean start'
47 rm -rf rootdir
/var
/lib
/apt
/lists rootdir
/var
/lib
/apt
/lists.good
48 # normal update works fine
49 testsuccess aptget update
50 mv rootdir
/var
/lib
/apt
/lists rootdir
/var
/lib
/apt
/lists.good
52 # starting fresh works
53 test_inreleasetoobig
"$1"
54 rm -rf aptarchive
/dists rootdir
/var
/lib
/apt
/lists
55 cp -a aptarchive
/dists.good aptarchive
/dists
56 test_packagestoobig
"$1"
57 rm -rf aptarchive
/dists rootdir
/var
/lib
/apt
/lists
58 cp -a aptarchive
/dists.good aptarchive
/dists
60 msgmsg
'Test with' "$1" 'and existing old data'
61 cp -a rootdir
/var
/lib
/apt
/lists.good rootdir
/var
/lib
/apt
/lists
62 test_inreleasetoobig
"$1"
63 rm -rf aptarchive
/dists rootdir
/var
/lib
/apt
/lists
64 cp -a rootdir
/var
/lib
/apt
/lists.good rootdir
/var
/lib
/apt
/lists
65 cp -a aptarchive
/dists.good aptarchive
/dists
66 test_packagestoobig
"$1"
67 rm -rf aptarchive
/dists
68 cp -a aptarchive
/dists.good aptarchive
/dists
72 methodtest
'http://localhost:8080'
74 changetohttpswebserver
75 methodtest
'https://localhost:4433'