[pacman-dev] [PATCH] pactest: add test cause for servers returning 404 with body
morganamilo
morganamilo at archlinux.org
Thu May 20 21:21:34 UTC 2021
Signed-off-by: morganamilo <morganamilo at archlinux.org>
---
test/pacman/meson.build | 1 +
.../tests/sync-failover-404-with-body.py | 24 +++++++++++++++++++
2 files changed, 25 insertions(+)
create mode 100644 test/pacman/tests/sync-failover-404-with-body.py
diff --git a/test/pacman/meson.build b/test/pacman/meson.build
index 0e75b3ee..ecab75b2 100644
--- a/test/pacman/meson.build
+++ b/test/pacman/meson.build
@@ -173,6 +173,7 @@ pacman_tests = [
'tests/symlink012.py',
'tests/symlink020.py',
'tests/symlink021.py',
+ 'tests/sync-failover-404-with-body.py',
'tests/sync-install-assumeinstalled.py',
'tests/sync-nodepversion01.py',
'tests/sync-nodepversion02.py',
diff --git a/test/pacman/tests/sync-failover-404-with-body.py b/test/pacman/tests/sync-failover-404-with-body.py
new file mode 100644
index 00000000..8022461d
--- /dev/null
+++ b/test/pacman/tests/sync-failover-404-with-body.py
@@ -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")
--
2.31.1
More information about the pacman-dev
mailing list