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