]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-update-ims
close leaking slave fd after setting up pty magic
[apt.git] / test / integration / test-apt-update-ims
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6 setupenvironment
7 configarchitecture 'amd64'
8
9 buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable'
10
11 setupaptarchive --no-update
12 changetowebserver
13
14 runtest() {
15 configallowinsecurerepositories "${1:-false}"
16
17 rm -f rootdir/var/lib/apt/lists/localhost*
18
19 if [ "$1" = 'true' ]; then
20 testwarning aptget update
21 else
22 testsuccess aptget update
23 fi
24
25 # ensure no leftovers in partial
26 testfailure ls "rootdir/var/lib/apt/lists/partial/*"
27
28 # check that I-M-S header is kept in redirections
29 testequal "$EXPECT" aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0
30
31 # ensure that we still do a hash check on ims hit
32 msgtest 'Test I-M-S' 'reverify'
33 aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A2 'ReceivedHash:' | grep -q -- '- SHA' && msgpass || msgfail
34
35 # ensure no leftovers in partial
36 testfailure ls "rootdir/var/lib/apt/lists/partial/*"
37 }
38
39 msgmsg "InRelease"
40 EXPECT="Hit http://localhost:8080 unstable InRelease
41 Hit http://localhost:8080 unstable/main Sources
42 Hit http://localhost:8080 unstable/main amd64 Packages
43 Hit http://localhost:8080 unstable/main Translation-en
44 Reading package lists..."
45 # with InRelease
46 runtest
47
48 # with gzip
49 echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
50 runtest
51
52 msgmsg "Release/Release.gpg"
53 # with Release/Release.gpg
54 EXPECT="Ign http://localhost:8080 unstable InRelease
55 404 Not Found
56 Hit http://localhost:8080 unstable Release
57 Hit http://localhost:8080 unstable Release.gpg
58 Hit http://localhost:8080 unstable/main Sources
59 Hit http://localhost:8080 unstable/main amd64 Packages
60 Hit http://localhost:8080 unstable/main Translation-en
61 Reading package lists..."
62
63 find aptarchive -name 'InRelease' -delete
64
65 echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex
66 runtest
67
68 echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
69 runtest
70
71 # no Release.gpg or InRelease
72 msgmsg "Release only"
73 EXPECT="Ign http://localhost:8080 unstable InRelease
74 404 Not Found
75 Hit http://localhost:8080 unstable Release
76 Ign http://localhost:8080 unstable Release.gpg
77 404 Not Found
78 Hit http://localhost:8080 unstable/main Sources
79 Hit http://localhost:8080 unstable/main amd64 Packages
80 Hit http://localhost:8080 unstable/main Translation-en
81 Reading package lists...
82 W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Packages from that repository can not be authenticated."
83
84 find aptarchive -name 'Release.gpg' -delete
85
86 echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex
87 runtest "true"
88
89 echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
90 runtest "true"