From 6045b3ffd6bf4c7d338e774be8e447661f9cac09 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 5 May 2023 11:49:27 -0700 Subject: [PATCH] test: Add mirrorlist test for org.osbuild.librepo These tests test downloading packages using mirrorlist: * Using a single mirrorlist repo * Using two mirrorlist repos * A bad checksum (or file) from the download which is expected to fail * Two mirrorlist paths with the first one returning a 404, expected to succeed with the 2nd mirrorlist path. --- .../cases/404-mirrorlist.json | 39 +++++++++++++++++++ .../cases/bad-mirrorlist-checksum.json | 39 +++++++++++++++++++ .../cases/one-mirrorlist.json | 25 ++++++++++++ .../cases/two-mirrorlist.json | 39 +++++++++++++++++++ .../data/mirrorlist/fedora | 1 + .../data/mirrorlist/one404 | 2 + .../data/mirrorlist/updates | 1 + 7 files changed, 146 insertions(+) create mode 100644 test/data/sources/org.osbuild.librepo/cases/404-mirrorlist.json create mode 100644 test/data/sources/org.osbuild.librepo/cases/bad-mirrorlist-checksum.json create mode 100644 test/data/sources/org.osbuild.librepo/cases/one-mirrorlist.json create mode 100644 test/data/sources/org.osbuild.librepo/cases/two-mirrorlist.json create mode 100644 test/data/sources/org.osbuild.librepo/data/mirrorlist/fedora create mode 100644 test/data/sources/org.osbuild.librepo/data/mirrorlist/one404 create mode 100644 test/data/sources/org.osbuild.librepo/data/mirrorlist/updates diff --git a/test/data/sources/org.osbuild.librepo/cases/404-mirrorlist.json b/test/data/sources/org.osbuild.librepo/cases/404-mirrorlist.json new file mode 100644 index 00000000..d0238415 --- /dev/null +++ b/test/data/sources/org.osbuild.librepo/cases/404-mirrorlist.json @@ -0,0 +1,39 @@ +{ + "expects": "success", + "org.osbuild.librepo": { + "items": { + "sha256:99fa21f1b67fea84dcb9b3c7f7e09a4f150095cfa7163a19d03972fd7c826f00": { + "path": "Packages/a/a", + "mirror": "0cde5945566ff3feb627eaa84e31223d2b8be54fb446222cded36fc5e5debcc2" + }, + "sha256:77e6ed0bed2d720e44d77643f66b05f0eb42b06379990e5ef658ef314c415827": { + "path": "Packages/b/b", + "mirror": "0cde5945566ff3feb627eaa84e31223d2b8be54fb446222cded36fc5e5debcc2" + }, + "sha256:e99efe314a66334179236e5fb6a2e6a6431daf6aeb516162e01517a0ac708252": { + "path": "Packages/c/c", + "mirror": "d68132295d14ad03bd676009c4fe8727f5040adfb91e20ac9919101d14ff4703" + }, + "sha256:354fe7c89ac014ed6479bf162fa7b9e8b37eddc7e46719ebd4349699d4e92c8c": { + "path": "Packages/d/d", + "mirror": "d68132295d14ad03bd676009c4fe8727f5040adfb91e20ac9919101d14ff4703" + } + }, + "options": { + "mirrors": { + "0cde5945566ff3feb627eaa84e31223d2b8be54fb446222cded36fc5e5debcc2": { + "url": "http://localhost/sources/org.osbuild.librepo/data/mirrorlist/one404", + "type": "mirrorlist", + "fastest-mirror": true, + "name": "mirrorlist" + }, + "d68132295d14ad03bd676009c4fe8727f5040adfb91e20ac9919101d14ff4703": { + "url": "http://localhost/sources/org.osbuild.librepo/data/mirrorlist/updates", + "type": "mirrorlist", + "fastest-mirror": true, + "name": "mirrorlist" + } + } + } + } +} diff --git a/test/data/sources/org.osbuild.librepo/cases/bad-mirrorlist-checksum.json b/test/data/sources/org.osbuild.librepo/cases/bad-mirrorlist-checksum.json new file mode 100644 index 00000000..e5ab32c3 --- /dev/null +++ b/test/data/sources/org.osbuild.librepo/cases/bad-mirrorlist-checksum.json @@ -0,0 +1,39 @@ +{ + "expects": "error", + "org.osbuild.librepo": { + "items": { + "sha256:99fa21f1b67fea84dcb9b3c7f7e09a4f150095cfa7163a19d03972fd7c826f00": { + "path": "Packages/a/a", + "mirror": "0cde5945566ff3feb627eaa84e31223d2b8be54fb446222cded36fc5e5debcc2" + }, + "sha256:77e6ed0bed2d720e44d77643f66b05f0eb42b06379990e5ef658ef314c415827": { + "path": "Packages/b/b", + "mirror": "0cde5945566ff3feb627eaa84e31223d2b8be54fb446222cded36fc5e5debcc2" + }, + "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa": { + "path": "Packages/c/c", + "mirror": "d68132295d14ad03bd676009c4fe8727f5040adfb91e20ac9919101d14ff4703" + }, + "sha256:354fe7c89ac014ed6479bf162fa7b9e8b37eddc7e46719ebd4349699d4e92c8c": { + "path": "Packages/d/d", + "mirror": "d68132295d14ad03bd676009c4fe8727f5040adfb91e20ac9919101d14ff4703" + } + }, + "options": { + "mirrors": { + "0cde5945566ff3feb627eaa84e31223d2b8be54fb446222cded36fc5e5debcc2": { + "url": "http://localhost/sources/org.osbuild.librepo/data/mirrorlist/fedora", + "type": "mirrorlist", + "fastest-mirror": true, + "name": "mirrorlist" + }, + "d68132295d14ad03bd676009c4fe8727f5040adfb91e20ac9919101d14ff4703": { + "url": "http://localhost/sources/org.osbuild.librepo/data/mirrorlist/updates", + "type": "mirrorlist", + "fastest-mirror": true, + "name": "mirrorlist" + } + } + } + } +} diff --git a/test/data/sources/org.osbuild.librepo/cases/one-mirrorlist.json b/test/data/sources/org.osbuild.librepo/cases/one-mirrorlist.json new file mode 100644 index 00000000..60438219 --- /dev/null +++ b/test/data/sources/org.osbuild.librepo/cases/one-mirrorlist.json @@ -0,0 +1,25 @@ +{ + "expects": "success", + "org.osbuild.librepo": { + "items": { + "sha256:99fa21f1b67fea84dcb9b3c7f7e09a4f150095cfa7163a19d03972fd7c826f00": { + "path": "Packages/a/a", + "mirror": "0cde5945566ff3feb627eaa84e31223d2b8be54fb446222cded36fc5e5debcc2" + }, + "sha256:77e6ed0bed2d720e44d77643f66b05f0eb42b06379990e5ef658ef314c415827": { + "path": "Packages/b/b", + "mirror": "0cde5945566ff3feb627eaa84e31223d2b8be54fb446222cded36fc5e5debcc2" + } + }, + "options": { + "mirrors": { + "0cde5945566ff3feb627eaa84e31223d2b8be54fb446222cded36fc5e5debcc2": { + "url": "http://localhost/sources/org.osbuild.librepo/data/mirrorlist/fedora", + "type": "mirrorlist", + "fastest-mirror": true, + "name": "mirrorlist" + } + } + } + } +} diff --git a/test/data/sources/org.osbuild.librepo/cases/two-mirrorlist.json b/test/data/sources/org.osbuild.librepo/cases/two-mirrorlist.json new file mode 100644 index 00000000..b17cfe9c --- /dev/null +++ b/test/data/sources/org.osbuild.librepo/cases/two-mirrorlist.json @@ -0,0 +1,39 @@ +{ + "expects": "success", + "org.osbuild.librepo": { + "items": { + "sha256:99fa21f1b67fea84dcb9b3c7f7e09a4f150095cfa7163a19d03972fd7c826f00": { + "path": "Packages/a/a", + "mirror": "0cde5945566ff3feb627eaa84e31223d2b8be54fb446222cded36fc5e5debcc2" + }, + "sha256:77e6ed0bed2d720e44d77643f66b05f0eb42b06379990e5ef658ef314c415827": { + "path": "Packages/b/b", + "mirror": "0cde5945566ff3feb627eaa84e31223d2b8be54fb446222cded36fc5e5debcc2" + }, + "sha256:e99efe314a66334179236e5fb6a2e6a6431daf6aeb516162e01517a0ac708252": { + "path": "Packages/c/c", + "mirror": "d68132295d14ad03bd676009c4fe8727f5040adfb91e20ac9919101d14ff4703" + }, + "sha256:354fe7c89ac014ed6479bf162fa7b9e8b37eddc7e46719ebd4349699d4e92c8c": { + "path": "Packages/d/d", + "mirror": "d68132295d14ad03bd676009c4fe8727f5040adfb91e20ac9919101d14ff4703" + } + }, + "options": { + "mirrors": { + "0cde5945566ff3feb627eaa84e31223d2b8be54fb446222cded36fc5e5debcc2": { + "url": "http://localhost/sources/org.osbuild.librepo/data/mirrorlist/fedora", + "type": "mirrorlist", + "fastest-mirror": true, + "name": "mirrorlist" + }, + "d68132295d14ad03bd676009c4fe8727f5040adfb91e20ac9919101d14ff4703": { + "url": "http://localhost/sources/org.osbuild.librepo/data/mirrorlist/updates", + "type": "mirrorlist", + "fastest-mirror": true, + "name": "mirrorlist" + } + } + } + } +} diff --git a/test/data/sources/org.osbuild.librepo/data/mirrorlist/fedora b/test/data/sources/org.osbuild.librepo/data/mirrorlist/fedora new file mode 100644 index 00000000..9bf24998 --- /dev/null +++ b/test/data/sources/org.osbuild.librepo/data/mirrorlist/fedora @@ -0,0 +1 @@ +http://localhost/sources/org.osbuild.librepo/data/ diff --git a/test/data/sources/org.osbuild.librepo/data/mirrorlist/one404 b/test/data/sources/org.osbuild.librepo/data/mirrorlist/one404 new file mode 100644 index 00000000..1eee65e0 --- /dev/null +++ b/test/data/sources/org.osbuild.librepo/data/mirrorlist/one404 @@ -0,0 +1,2 @@ +http://localhost/sources/org.osbuild.librepo/data/404/ +http://localhost/sources/org.osbuild.librepo/data/ diff --git a/test/data/sources/org.osbuild.librepo/data/mirrorlist/updates b/test/data/sources/org.osbuild.librepo/data/mirrorlist/updates new file mode 100644 index 00000000..9246dae3 --- /dev/null +++ b/test/data/sources/org.osbuild.librepo/data/mirrorlist/updates @@ -0,0 +1 @@ +http://localhost/sources/org.osbuild.librepo/data/updates/