From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E5C6F158020 for ; Sat, 22 Oct 2022 08:57:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 12B61E0907; Sat, 22 Oct 2022 08:57:52 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E9B79E0907 for ; Sat, 22 Oct 2022 08:57:51 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CC72634119D for ; Sat, 22 Oct 2022 08:57:50 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 082A1615 for ; Sat, 22 Oct 2022 08:57:49 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1666428911.807e6229e5ebc20f8372d053af47577dee74ccd2.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: testdata/repos/network/MetadataUrlCheck/RedirectedUrl/, ... X-VCS-Repository: proj/pkgcore/pkgcheck X-VCS-Files: testdata/data/repos/network/MetadataUrlCheck/RedirectedUrl/expected.json testdata/repos/network/MetadataUrlCheck/RedirectedUrl/metadata.xml testdata/repos/network/MetadataUrlCheck/RedirectedUrl/responses.py X-VCS-Directories: testdata/data/repos/network/MetadataUrlCheck/RedirectedUrl/ testdata/repos/network/MetadataUrlCheck/RedirectedUrl/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: 807e6229e5ebc20f8372d053af47577dee74ccd2 X-VCS-Branch: master Date: Sat, 22 Oct 2022 08:57:49 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: b7708f7c-5370-4678-86bf-953346bccb54 X-Archives-Hash: 64aab760fe5743bba251bf919d3bf7c0 commit: 807e6229e5ebc20f8372d053af47577dee74ccd2 Author: Arthur Zamarin gentoo org> AuthorDate: Sat Oct 22 08:55:11 2022 +0000 Commit: Arthur Zamarin gentoo 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 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 @@ pkgcore/pkgcheck https://github.com/pkgcore/pkgcheck - https://github.com/pkgcore/pkgcheck/changelog 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]