pactest: add test case for servers returning 404 with body

Signed-off-by: morganamilo <morganamilo@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
morganamilo 2021-05-20 22:21:34 +01:00 committed by Allan McRae
parent 3401f9e142
commit 2e83a52205
2 changed files with 25 additions and 0 deletions

View file

@ -173,6 +173,7 @@ pacman_tests = [
'tests/symlink012.py', 'tests/symlink012.py',
'tests/symlink020.py', 'tests/symlink020.py',
'tests/symlink021.py', 'tests/symlink021.py',
'tests/sync-failover-404-with-body.py',
'tests/sync-install-assumeinstalled.py', 'tests/sync-install-assumeinstalled.py',
'tests/sync-nodepversion01.py', 'tests/sync-nodepversion01.py',
'tests/sync-nodepversion02.py', 'tests/sync-nodepversion02.py',

View file

@ -0,0 +1,24 @@
self.description = "server failover after 404"
self.require_capability("curl")
p1 = pmpkg('pkg')
self.addpkg2db('sync', p1)
url_broke = self.add_simple_http_server({
'/{}'.format(p1.filename()): {
'code': 404,
'body': 'a',
}
})
url_good = self.add_simple_http_server({
'/{}'.format(p1.filename()): p1.makepkg_bytes(),
})
self.db['sync'].option['Server'] = [ url_broke, url_good ]
self.db['sync'].syncdir = False
self.cachepkgs = False
self.args = '-S pkg'
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_EXIST=pkg")