4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
'amd64' 'i386'
10 insertpackage
'unstable' 'apt' 'all' '1.0'
12 setupaptarchive
--no-update
15 msgmsg
'Test InRelease with' "$1"
16 rm -rf rootdir
/var
/lib
/apt
/lists
17 cp -a aptarchive
/dists aptarchive
/dists.good
18 # get our cache populated
19 testsuccess aptget update
20 listcurrentlistsdirectory
> listsdir.lst
22 # hit again with a good cache
23 testsuccessequal
"Hit:1 $1 unstable InRelease
24 Reading package lists..." aptget update
25 testfileequal
'listsdir.lst' "$(listcurrentlistsdirectory)"
27 # drop an architecture, which means the file should be gone now
28 configarchitecture
'i386'
29 sed '/_binary-amd64_Packages/ d' listsdir.lst
> listsdir
-without-amd64.lst
30 testsuccessequal
"Hit:1 $1 unstable InRelease
31 Reading package lists..." aptget update
32 testfileequal
'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
34 # readd arch so its downloaded again…
35 configarchitecture
'amd64' 'i386'
36 # … but oh noes, hashsum mismatch!
37 find aptarchive
/dists
/unstable
/main
/binary
-amd64/ -type f
-delete
38 cat >> aptarchive
/dists
/unstable
/main
/binary
-amd64/Packages
<<EOF
44 compressfile aptarchive
/dists
/unstable
/main
/binary
-amd64/Packages
45 testfailureequal
"Hit:1 $1 unstable InRelease
46 Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
47 Err:2 $1 unstable/main amd64 Packages
49 Reading package lists...
50 W: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
51 E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
52 testfileequal
'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
53 rm -rf aptarchive
/dists
54 cp -a aptarchive
/dists.good aptarchive
/dists
56 # … now everything is fine again
57 testsuccessequal
"Hit:1 $1 unstable InRelease
58 Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
59 Reading package lists..." aptget update
60 testfileequal
'listsdir.lst' "$(listcurrentlistsdirectory)"
62 webserverconfig
'aptwebserver::support::modified-since' 'false'
63 webserverconfig
'aptwebserver::support::last-modified' 'false'
64 testsuccessequal
"Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B]
65 Reading package lists..." aptget update
66 webserverconfig
'aptwebserver::support::modified-since' 'true'
67 webserverconfig
'aptwebserver::support::last-modified' 'true'
69 msgmsg
'Test Release.gpg with' "$1"
70 rm -rf rootdir
/var
/lib
/apt
/lists
71 find aptarchive
/dists
-name 'InRelease' -delete
72 # get our cache populated
73 testsuccess aptget update
74 listcurrentlistsdirectory
> listsdir.lst
76 # hit again with a good cache
77 testsuccessequal
"Ign:1 $1 unstable InRelease
79 Hit:2 $1 unstable Release
80 Reading package lists..." aptget update
81 testfileequal
'listsdir.lst' "$(listcurrentlistsdirectory)"
83 # drop an architecture, which means the file should be gone now
84 configarchitecture
'i386'
85 sed '/_binary-amd64_Packages/ d' listsdir.lst
> listsdir
-without-amd64.lst
86 testsuccessequal
"Ign:1 $1 unstable InRelease
88 Hit:2 $1 unstable Release
89 Reading package lists..." aptget update
90 testfileequal
'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
92 # readd arch so its downloaded again…
93 configarchitecture
'amd64' 'i386'
94 # … but oh noes, hashsum mismatch!
95 find aptarchive
/dists
/unstable
/main
/binary
-amd64/ -type f
-delete
96 cat >> aptarchive
/dists
/unstable
/main
/binary
-amd64/Packages
<<EOF
102 compressfile aptarchive
/dists
/unstable
/main
/binary
-amd64/Packages
103 testfailureequal
"Ign:1 $1 unstable InRelease
105 Hit:2 $1 unstable Release
106 Get:4 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
107 Err:4 $1 unstable/main amd64 Packages
109 Reading package lists...
110 W: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
111 E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
112 testfileequal
'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
113 rm -rf aptarchive
/dists
114 cp -a aptarchive
/dists.good aptarchive
/dists
115 find aptarchive
/dists
-name 'InRelease' -delete
117 # … now everything is fine again
118 testsuccessequal
"Ign:1 $1 unstable InRelease
120 Hit:2 $1 unstable Release
121 Get:4 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
122 Reading package lists..." aptget update
123 testfileequal
'listsdir.lst' "$(listcurrentlistsdirectory)"
125 webserverconfig
'aptwebserver::support::modified-since' 'false'
126 webserverconfig
'aptwebserver::support::last-modified' 'false'
127 testsuccessequal
"Ign:1 $1 unstable InRelease
129 Get:2 $1 unstable Release [$(stat -c '%s' 'aptarchive/dists/unstable/Release') B]
130 Reading package lists..." aptget update
131 webserverconfig
'aptwebserver::support::modified-since' 'true'
132 webserverconfig
'aptwebserver::support::last-modified' 'true'
134 rm -rf aptarchive
/dists
135 cp -a aptarchive
/dists.good aptarchive
/dists
137 # new release file, but the indexes are the same
138 redatereleasefiles
'+2 hours'
140 rm -rf rootdir
/var
/lib
/apt
/lists.good
141 cp -a rootdir
/var
/lib
/apt
/lists rootdir
/var
/lib
/apt
/lists.good
142 testsuccessequal
"Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B]
143 Reading package lists..." aptget update
145 rm -rf rootdir
/var
/lib
/apt
/lists
146 cp -a rootdir
/var
/lib
/apt
/lists.good rootdir
/var
/lib
/apt
/lists
147 find rootdir
/var
/lib
/apt
/lists
-name '*_Packages*' -delete
148 testsuccessequal
"Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B]
149 Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
150 Get:3 $1 unstable/main i386 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-i386/Packages.gz') B]
151 Reading package lists..." aptget update
153 rm -rf aptarchive
/dists
154 cp -a aptarchive
/dists.good aptarchive
/dists
158 methodtest
"http://localhost:${APTHTTPPORT}"
160 changetohttpswebserver
161 methodtest
"https://localhost:${APTHTTPSPORT}"