]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-apt-update-not-modified
test, travis: Quieter testing with a new -qq mode
[apt.git] / test / integration / test-apt-update-not-modified
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6
7setupenvironment
8configarchitecture 'amd64' 'i386'
9confighashes 'SHA256'
10
11insertpackage 'unstable' 'apt' 'amd64,i386' '1.0'
12
13export APT_DONT_SIGN=''
14setupaptarchive --no-update
15
16methodtest() {
17 msgmsg 'Test InRelease with' "$1"
18 rm -rf rootdir/var/lib/apt/lists
19 cp -a aptarchive/dists aptarchive/dists.good
20 # get our cache populated
21 testsuccess aptget update
22 listcurrentlistsdirectory > listsdir.lst
23
24 # hit again with a good cache
25 testsuccessequal "Hit:1 $1 unstable InRelease
26Reading package lists..." aptget update
27 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
28
29 # drop an architecture, which means the file should be gone now
30 configarchitecture 'i386'
31 sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
32 testsuccessequal "Hit:1 $1 unstable InRelease
33Reading package lists..." aptget update
34 testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
35
36 # readd arch so its downloaded again…
37 configarchitecture 'amd64' 'i386'
38 # … but oh noes, hashsum mismatch!
39 SIZE=$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
40 mv aptarchive/dists/unstable/main/binary-amd64/Packages.gz aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig
41 cat > aptarchive/dists/unstable/main/binary-amd64/Packages <<EOF
42Package: thisisbad
43Architecture: amd64
44Version: 1
45EOF
46 compressfile aptarchive/dists/unstable/main/binary-amd64/Packages
47 testfailureequal "Hit:1 $1 unstable InRelease
48Get:2 $1 unstable/main amd64 Packages [$SIZE B]
49Err:2 $1 unstable/main amd64 Packages
50 Hash Sum mismatch
51 Hashes of expected file:
52 - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig') [weak]
53 - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig' | cut -d' ' -f 1)
54 Hashes of received file:
55 - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
56 - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak]
57 Last modification reported: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
58 Release file created at: $(releasefiledate 'aptarchive/dists/unstable/InRelease')
59Reading package lists...
60E: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
61 Hashes of expected file:
62 - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig') [weak]
63 - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig' | cut -d' ' -f 1)
64 Hashes of received file:
65 - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
66 - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak]
67 Last modification reported: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
68 Release file created at: $(releasefiledate 'aptarchive/dists/unstable/InRelease')
69E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
70 testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
71 rm -rf aptarchive/dists
72 cp -a aptarchive/dists.good aptarchive/dists
73
74 # … now everything is fine again
75 testsuccessequal "Hit:1 $1 unstable InRelease
76Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
77Reading package lists..." aptget update
78 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
79
80 webserverconfig 'aptwebserver::support::modified-since' 'false'
81 webserverconfig 'aptwebserver::support::last-modified' 'false'
82 testsuccessequal "Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B]
83Reading package lists..." aptget update
84 webserverconfig 'aptwebserver::support::modified-since' 'true'
85 webserverconfig 'aptwebserver::support::last-modified' 'true'
86
87 msgmsg 'Test Release.gpg with' "$1"
88 rm -rf rootdir/var/lib/apt/lists
89 find aptarchive/dists -name 'InRelease' -delete
90 # get our cache populated
91 testsuccess aptget update
92 listcurrentlistsdirectory > listsdir.lst
93
94 # hit again with a good cache
95 testsuccessequal "Ign:1 $1 unstable InRelease
96 404 Not Found
97Hit:2 $1 unstable Release
98Reading package lists..." aptget update
99 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
100
101 # drop an architecture, which means the file should be gone now
102 configarchitecture 'i386'
103 sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
104 testsuccessequal "Ign:1 $1 unstable InRelease
105 404 Not Found
106Hit:2 $1 unstable Release
107Reading package lists..." aptget update
108 testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
109
110 # readd arch so its downloaded again…
111 configarchitecture 'amd64' 'i386'
112 # … but oh noes, hashsum mismatch!
113 SIZE=$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
114 mv aptarchive/dists/unstable/main/binary-amd64/Packages.gz aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig
115 cat > aptarchive/dists/unstable/main/binary-amd64/Packages <<EOF
116Package: thisisbad
117Architecture: amd64
118Version: 1
119EOF
120 compressfile aptarchive/dists/unstable/main/binary-amd64/Packages
121 testfailureequal "Ign:1 $1 unstable InRelease
122 404 Not Found
123Hit:2 $1 unstable Release
124Get:4 $1 unstable/main amd64 Packages [$SIZE B]
125Err:4 $1 unstable/main amd64 Packages
126 Hash Sum mismatch
127 Hashes of expected file:
128 - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig') [weak]
129 - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig' | cut -d' ' -f 1)
130 Hashes of received file:
131 - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
132 - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak]
133 Last modification reported: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
134 Release file created at: $(releasefiledate 'aptarchive/dists/unstable/Release')
135Reading package lists...
136E: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
137 Hashes of expected file:
138 - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig') [weak]
139 - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig' | cut -d' ' -f 1)
140 Hashes of received file:
141 - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
142 - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak]
143 Last modification reported: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
144 Release file created at: $(releasefiledate 'aptarchive/dists/unstable/Release')
145E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
146 testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
147 rm -rf aptarchive/dists
148 cp -a aptarchive/dists.good aptarchive/dists
149 find aptarchive/dists -name 'InRelease' -delete
150
151 # … now everything is fine again
152 testsuccessequal "Ign:1 $1 unstable InRelease
153 404 Not Found
154Hit:2 $1 unstable Release
155Get:4 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
156Reading package lists..." aptget update
157 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
158
159 webserverconfig 'aptwebserver::support::modified-since' 'false'
160 webserverconfig 'aptwebserver::support::last-modified' 'false'
161 testsuccessequal "Ign:1 $1 unstable InRelease
162 404 Not Found
163Get:2 $1 unstable Release [$(stat -c '%s' 'aptarchive/dists/unstable/Release') B]
164Reading package lists..." aptget update
165 webserverconfig 'aptwebserver::support::modified-since' 'true'
166 webserverconfig 'aptwebserver::support::last-modified' 'true'
167
168 rm -rf aptarchive/dists
169 cp -a aptarchive/dists.good aptarchive/dists
170
171 # new release file, but the indexes are the same
172 redatereleasefiles '+2 hours'
173
174 rm -rf rootdir/var/lib/apt/lists.good
175 cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.good
176 testsuccessequal "Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B]
177Reading package lists..." aptget update
178
179 rm -rf rootdir/var/lib/apt/lists
180 cp -a rootdir/var/lib/apt/lists.good rootdir/var/lib/apt/lists
181 find rootdir/var/lib/apt/lists -name '*_Packages*' -delete
182 testsuccessequal "Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B]
183Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
184Get:3 $1 unstable/main i386 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-i386/Packages.gz') B]
185Reading package lists..." aptget update
186
187 rm -rf aptarchive/dists
188 cp -a aptarchive/dists.good aptarchive/dists
189}
190
191changetowebserver
192methodtest "http://localhost:${APTHTTPPORT}"
193
194changetohttpswebserver
195methodtest "https://localhost:${APTHTTPSPORT}"