]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-apt-update-expected-size
show apt-key warnings in apt update
[apt.git] / test / integration / test-apt-update-expected-size
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6
7setupenvironment
8configarchitecture 'i386'
9configcompression '.' 'gz'
10
11insertpackage 'unstable' 'apt' 'i386' '1.0'
12
13export APT_DONT_SIGN=''
14setupaptarchive --no-update
15cp -a aptarchive/dists aptarchive/dists.good
16
17test_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
25 rm -f update.output
26 # ensure the failed InRelease file got renamed
27 testsuccess ls rootdir/var/lib/apt/lists/partial/*InRelease.FAILED
28}
29
30test_packagestoobig() {
31 insertpackage 'unstable' 'foo' 'i386' '1.0'
32 buildaptarchivefromfiles '+1 hour'
33 signreleasefiles
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"
39 done
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)
42E: 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
43}
44
45methodtest() {
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
49
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
55
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
63
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
73}
74
75changetowebserver
76methodtest "http://localhost:${APTHTTPPORT}"
77
78changetohttpswebserver
79methodtest "https://localhost:${APTHTTPSPORT}"