pactest: add tests for downloading packages from a cdn
Test for downloads that redirect to some sort of cdn where the redirected url does not relate to the original filename. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
2ec6de96a6
commit
f951282bec
1 changed files with 22 additions and 1 deletions
|
@ -22,6 +22,12 @@ url = self.add_simple_http_server({
|
||||||
'/redir-dest.pkg': 'redir-dest',
|
'/redir-dest.pkg': 'redir-dest',
|
||||||
'/redir-dest.pkg.sig': 'redir-dest.sig',
|
'/redir-dest.pkg.sig': 'redir-dest.sig',
|
||||||
|
|
||||||
|
# redirect cdn
|
||||||
|
'/redir-cdn.pkg': { 'code': 303, 'headers': { 'Location': '/cdn-1' } },
|
||||||
|
'/redir-cdn.pkg.sig': { 'code': 303, 'headers': { 'Location': '/cdn-2' } },
|
||||||
|
'/cdn-1': 'redir-dest',
|
||||||
|
'/cdn-2': 'redir-dest.sig',
|
||||||
|
|
||||||
# content-disposition and redirect
|
# content-disposition and redirect
|
||||||
'/cd-redir.pkg': { 'code': 303, 'headers': { 'Location': '/cd-redir-dest.pkg' } },
|
'/cd-redir.pkg': { 'code': 303, 'headers': { 'Location': '/cd-redir-dest.pkg' } },
|
||||||
'/cd-redir-dest.pkg': {
|
'/cd-redir-dest.pkg': {
|
||||||
|
@ -30,6 +36,18 @@ url = self.add_simple_http_server({
|
||||||
},
|
},
|
||||||
'/cd-redir-dest.pkg.sig': 'cd-redir-dest.sig',
|
'/cd-redir-dest.pkg.sig': 'cd-redir-dest.sig',
|
||||||
|
|
||||||
|
# content-disposition and redirect to cdn
|
||||||
|
'/cd-redir-cdn.pkg': { 'code': 303, 'headers': { 'Location': '/cdn-3' } },
|
||||||
|
'/cd-redir-cdn.pkg.sig': { 'code': 303, 'headers': { 'Location': '/cdn-4' } },
|
||||||
|
'/cdn-3': {
|
||||||
|
'headers': { 'Content-Disposition': 'attachment; filename="cdn-alt.pkg"' },
|
||||||
|
'body': 'cdn-alt'
|
||||||
|
},
|
||||||
|
'/cdn-4': {
|
||||||
|
'headers': { 'Content-Disposition': 'attachment; filename="cdn-alt.pkg.sig"' },
|
||||||
|
'body': 'cdn-alt.sig'
|
||||||
|
},
|
||||||
|
|
||||||
# TODO: absolutely terrible hack to prevent pacman from attempting to
|
# TODO: absolutely terrible hack to prevent pacman from attempting to
|
||||||
# validate packages, which causes failure under --valgrind thanks to
|
# validate packages, which causes failure under --valgrind thanks to
|
||||||
# a memory leak in gpgme that is too general for inclusion in valgrind.supp
|
# a memory leak in gpgme that is too general for inclusion in valgrind.supp
|
||||||
|
@ -38,7 +56,7 @@ url = self.add_simple_http_server({
|
||||||
'': 'fallback',
|
'': 'fallback',
|
||||||
})
|
})
|
||||||
|
|
||||||
self.args = '-Uw {url}/simple.pkg {url}/cd.pkg {url}/redir.pkg {url}/cd-redir.pkg {url}/404'.format(url=url)
|
self.args = '-Uw {url}/simple.pkg {url}/cd.pkg {url}/redir.pkg {url}/redir-cdn.pkg {url}/cd-redir.pkg {url}/cd-redir-cdn.pkg {url}/404'.format(url=url)
|
||||||
|
|
||||||
# packages/sigs are not valid, error is expected
|
# packages/sigs are not valid, error is expected
|
||||||
self.addrule('!PACMAN_RETCODE=0')
|
self.addrule('!PACMAN_RETCODE=0')
|
||||||
|
@ -59,3 +77,6 @@ self.addrule('!CACHE_FEXISTS=cd-redir.pkg')
|
||||||
self.addrule('!CACHE_FEXISTS=cd-redir-dest.pkg')
|
self.addrule('!CACHE_FEXISTS=cd-redir-dest.pkg')
|
||||||
self.addrule('CACHE_FCONTENTS=cd-redir-dest-alt.pkg|cd-redir-dest')
|
self.addrule('CACHE_FCONTENTS=cd-redir-dest-alt.pkg|cd-redir-dest')
|
||||||
self.addrule('CACHE_FCONTENTS=cd-redir-dest-alt.pkg.sig|cd-redir-dest.sig')
|
self.addrule('CACHE_FCONTENTS=cd-redir-dest-alt.pkg.sig|cd-redir-dest.sig')
|
||||||
|
|
||||||
|
self.addrule('CACHE_FCONTENTS=cdn-alt.pkg|cdn-alt')
|
||||||
|
self.addrule('CACHE_FCONTENTS=cdn-alt.pkg.sig|cdn-alt.sig')
|
||||||
|
|
Loading…
Add table
Reference in a new issue