public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: testdata/repos/network/MetadataUrlCheck/RedirectedUrl/, ...
@ 2022-10-22  8:57 Arthur Zamarin
  0 siblings, 0 replies; only message in thread
From: Arthur Zamarin @ 2022-10-22  8:57 UTC (permalink / raw
  To: gentoo-commits

commit:     807e6229e5ebc20f8372d053af47577dee74ccd2
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 22 08:55:11 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Oct 22 08:55:11 2022 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=807e6229

tests: fix flaky network scan MetadataUrlCheck/RedirectedUrl

Because of undefined order between requests call by the check (as they
are performed in parallel), the test could fail if there was no match
with the expected requests replies.

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 .../MetadataUrlCheck/RedirectedUrl/expected.json   |  1 -
 .../MetadataUrlCheck/RedirectedUrl/metadata.xml    |  1 -
 .../MetadataUrlCheck/RedirectedUrl/responses.py    | 29 ++++++----------------
 3 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/testdata/data/repos/network/MetadataUrlCheck/RedirectedUrl/expected.json b/testdata/data/repos/network/MetadataUrlCheck/RedirectedUrl/expected.json
index ef65eafc..5b515d16 100644
--- a/testdata/data/repos/network/MetadataUrlCheck/RedirectedUrl/expected.json
+++ b/testdata/data/repos/network/MetadataUrlCheck/RedirectedUrl/expected.json
@@ -1,3 +1,2 @@
-{"__class__": "RedirectedUrl", "category": "MetadataUrlCheck", "package": "RedirectedUrl", "version": "0", "attr": "metadata.xml: changelog", "url": "https://github.com/pkgcore/pkgcheck/changelog", "new_url": "https://github.com/pkgcore/pkgcheck/news"}
 {"__class__": "RedirectedUrl", "category": "MetadataUrlCheck", "package": "RedirectedUrl", "version": "0", "attr": "metadata.xml: remote-id", "url": "https://github.com/pkgcore/pkgcheck", "new_url": "https://github.com/pkgcore/pkgcheck/"}
 {"__class__": "RedirectedUrl", "category": "MetadataUrlCheck", "package": "RedirectedUrl", "version": "0", "attr": "metadata.xml: doc", "url": "https://github.com/pkgcore/pkgcheck", "new_url": "https://github.com/pkgcore/pkgcheck/"}

diff --git a/testdata/repos/network/MetadataUrlCheck/RedirectedUrl/metadata.xml b/testdata/repos/network/MetadataUrlCheck/RedirectedUrl/metadata.xml
index 97b42470..522f6234 100644
--- a/testdata/repos/network/MetadataUrlCheck/RedirectedUrl/metadata.xml
+++ b/testdata/repos/network/MetadataUrlCheck/RedirectedUrl/metadata.xml
@@ -4,6 +4,5 @@
 	<upstream>
 		<remote-id type="github">pkgcore/pkgcheck</remote-id>
 		<doc>https://github.com/pkgcore/pkgcheck</doc>
-		<changelog>https://github.com/pkgcore/pkgcheck/changelog</changelog>
 	</upstream>
 </pkgmetadata>

diff --git a/testdata/repos/network/MetadataUrlCheck/RedirectedUrl/responses.py b/testdata/repos/network/MetadataUrlCheck/RedirectedUrl/responses.py
index 0c4e3565..7567a614 100644
--- a/testdata/repos/network/MetadataUrlCheck/RedirectedUrl/responses.py
+++ b/testdata/repos/network/MetadataUrlCheck/RedirectedUrl/responses.py
@@ -1,21 +1,6 @@
 import io
 
 from requests.models import Response
-
-r_hist = Response()
-r_hist.status_code = 301
-r_hist.reason = 'Moved Permanently'
-r_hist.url = 'https://github.com/pkgcore/pkgcheck/changelog'
-r_hist.headers = {'location': 'https://github.com/pkgcore/pkgcheck/news'}
-r_hist.raw = io.StringIO()
-
-r1 = Response()
-r1.status_code = 200
-r1.reason = 'OK'
-r1.url = 'https://github.com/pkgcore/pkgcheck/changelog'
-r1.raw = io.StringIO()
-r1.history = [r_hist]
-
 r_hist = Response()
 r_hist.status_code = 301
 r_hist.reason = 'Moved Permanently'
@@ -23,11 +8,11 @@ r_hist.url = 'https://github.com/pkgcore/pkgcheck'
 r_hist.headers = {'location': 'https://github.com/pkgcore/pkgcheck/'}
 r_hist.raw = io.StringIO()
 
-r2 = Response()
-r2.status_code = 301
-r2.reason = 'OK'
-r2.url = 'https://github.com/pkgcore/pkgcheck'
-r2.raw = io.StringIO()
-r2.history = [r_hist]
+r = Response()
+r.status_code = 301
+r.reason = 'OK'
+r.url = 'https://github.com/pkgcore/pkgcheck'
+r.raw = io.StringIO()
+r.history = [r_hist]
 
-responses = [r1, r2]
+responses = [r]


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-22  8:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-22  8:57 [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: testdata/repos/network/MetadataUrlCheck/RedirectedUrl/, Arthur Zamarin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox