]>
Commit | Line | Data |
---|---|---|
ba6b79bd DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
3abb6a6a DK |
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
5 | . "$TESTDIR/framework" | |
ba6b79bd DK |
6 | |
7 | setupenvironment | |
8 | configarchitecture 'amd64' 'i386' | |
0340069c | 9 | confighashes 'SHA256' |
ba6b79bd | 10 | |
1dd20368 | 11 | insertpackage 'unstable' 'apt' 'amd64,i386' '1.0' |
ba6b79bd DK |
12 | |
13 | setupaptarchive --no-update | |
14 | ||
15 | methodtest() { | |
8eafc759 | 16 | msgmsg 'Test InRelease with' "$1" |
ba6b79bd | 17 | rm -rf rootdir/var/lib/apt/lists |
58702f85 | 18 | cp -a aptarchive/dists aptarchive/dists.good |
ba6b79bd DK |
19 | # get our cache populated |
20 | testsuccess aptget update | |
21 | listcurrentlistsdirectory > listsdir.lst | |
22 | ||
23 | # hit again with a good cache | |
1eb1836f | 24 | testsuccessequal "Hit:1 $1 unstable InRelease |
ba6b79bd DK |
25 | Reading 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 | |
1eb1836f | 31 | testsuccessequal "Hit:1 $1 unstable InRelease |
ba6b79bd DK |
32 | Reading package lists..." aptget update |
33 | testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)" | |
34 | ||
58702f85 | 35 | # readd arch so its downloaded again… |
ba6b79bd | 36 | configarchitecture 'amd64' 'i386' |
58702f85 | 37 | # … but oh noes, hashsum mismatch! |
0340069c DK |
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 | |
58702f85 DK |
41 | Package: thisisbad |
42 | Architecture: amd64 | |
43 | Version: 1 | |
44 | EOF | |
45 | compressfile aptarchive/dists/unstable/main/binary-amd64/Packages | |
1eb1836f | 46 | testfailureequal "Hit:1 $1 unstable InRelease |
fb193b1c | 47 | Get:2 $1 unstable/main amd64 Packages [$SIZE B] |
1eb1836f | 48 | Err:2 $1 unstable/main amd64 Packages |
448c38bd | 49 | Hash Sum mismatch |
0340069c DK |
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') | |
95278287 | 58 | Reading package lists... |
f695e761 | 59 | E: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch |
0340069c DK |
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') | |
58702f85 DK |
68 | E: 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 | |
1eb1836f DK |
74 | testsuccessequal "Hit:1 $1 unstable InRelease |
75 | Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] | |
ba6b79bd DK |
76 | Reading package lists..." aptget update |
77 | testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" | |
8eafc759 DK |
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] | |
82 | Reading 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 | |
8eafc759 DK |
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 | |
1eb1836f | 94 | testsuccessequal "Ign:1 $1 unstable InRelease |
8eafc759 | 95 | 404 Not Found |
1eb1836f | 96 | Hit:2 $1 unstable Release |
8eafc759 DK |
97 | Reading 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 | |
1eb1836f | 103 | testsuccessequal "Ign:1 $1 unstable InRelease |
8eafc759 | 104 | 404 Not Found |
1eb1836f | 105 | Hit:2 $1 unstable Release |
8eafc759 DK |
106 | Reading package lists..." aptget update |
107 | testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)" | |
108 | ||
448c38bd | 109 | # readd arch so its downloaded again… |
8eafc759 | 110 | configarchitecture 'amd64' 'i386' |
448c38bd | 111 | # … but oh noes, hashsum mismatch! |
0340069c DK |
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 | |
448c38bd DK |
115 | Package: thisisbad |
116 | Architecture: amd64 | |
117 | Version: 1 | |
118 | EOF | |
119 | compressfile aptarchive/dists/unstable/main/binary-amd64/Packages | |
1eb1836f | 120 | testfailureequal "Ign:1 $1 unstable InRelease |
448c38bd | 121 | 404 Not Found |
1eb1836f | 122 | Hit:2 $1 unstable Release |
fb193b1c | 123 | Get:4 $1 unstable/main amd64 Packages [$SIZE B] |
1eb1836f | 124 | Err:4 $1 unstable/main amd64 Packages |
448c38bd | 125 | Hash Sum mismatch |
0340069c DK |
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') | |
95278287 | 134 | Reading package lists... |
f695e761 | 135 | E: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch |
0340069c DK |
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') | |
448c38bd DK |
144 | E: 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 | |
1eb1836f | 151 | testsuccessequal "Ign:1 $1 unstable InRelease |
8eafc759 | 152 | 404 Not Found |
1eb1836f DK |
153 | Hit:2 $1 unstable Release |
154 | Get:4 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] | |
8eafc759 DK |
155 | Reading package lists..." aptget update |
156 | testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" | |
157 | ||
158 | webserverconfig 'aptwebserver::support::modified-since' 'false' | |
159 | webserverconfig 'aptwebserver::support::last-modified' 'false' | |
1eb1836f | 160 | testsuccessequal "Ign:1 $1 unstable InRelease |
8eafc759 | 161 | 404 Not Found |
1eb1836f | 162 | Get:2 $1 unstable Release [$(stat -c '%s' 'aptarchive/dists/unstable/Release') B] |
8eafc759 DK |
163 | Reading 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 | |
8d041b4f DK |
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] | |
176 | Reading 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] | |
182 | Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] | |
183 | Get:3 $1 unstable/main i386 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-i386/Packages.gz') B] | |
184 | Reading package lists..." aptget update | |
185 | ||
186 | rm -rf aptarchive/dists | |
187 | cp -a aptarchive/dists.good aptarchive/dists | |
ba6b79bd DK |
188 | } |
189 | ||
190 | changetowebserver | |
6c0765c0 | 191 | methodtest "http://localhost:${APTHTTPPORT}" |
ba6b79bd DK |
192 | |
193 | changetohttpswebserver | |
6c0765c0 | 194 | methodtest "https://localhost:${APTHTTPSPORT}" |