From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 4El/M4Ok6WGjYQEAgWs5BA (envelope-from ) for ; Thu, 20 Jan 2022 19:05:55 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id aPl3MIOk6WHdMgAAauVa8A (envelope-from ) for ; Thu, 20 Jan 2022 19:05:55 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7E96143EB1 for ; Thu, 20 Jan 2022 19:05:55 +0100 (CET) Received: from localhost ([::1]:46374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nAboo-0001ZY-Nh for larch@yhetil.org; Thu, 20 Jan 2022 13:05:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50806) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAXCX-0004EJ-8s for guix-patches@gnu.org; Thu, 20 Jan 2022 08:10:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35572) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nAXCV-0006SQ-9c for guix-patches@gnu.org; Thu, 20 Jan 2022 08:10:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nAXCV-0004t2-3j for guix-patches@gnu.org; Thu, 20 Jan 2022 08:10:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53389] [PATCH 4/9] tests/import-github: Run a HTTP server instead of mocking. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 20 Jan 2022 13:10:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53389 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53389@debbugs.gnu.org Cc: ludo@gnu.org, Maxime Devos Received: via spool by 53389-submit@debbugs.gnu.org id=B53389.164268415818680 (code B ref 53389); Thu, 20 Jan 2022 13:10:03 +0000 Received: (at 53389) by debbugs.gnu.org; 20 Jan 2022 13:09:18 +0000 Received: from localhost ([127.0.0.1]:56698 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nAXBi-0004r3-EG for submit@debbugs.gnu.org; Thu, 20 Jan 2022 08:09:18 -0500 Received: from baptiste.telenet-ops.be ([195.130.132.51]:42030) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nAXBM-0004ou-4a for 53389@debbugs.gnu.org; Thu, 20 Jan 2022 08:08:54 -0500 Received: from localhost.localdomain ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by baptiste.telenet-ops.be with bizsmtp id l18q2600H4UW6Th0118rNS; Thu, 20 Jan 2022 14:08:51 +0100 From: Maxime Devos Date: Thu, 20 Jan 2022 13:08:44 +0000 Message-Id: <20220120130849.292178-4-maximedevos@telenet.be> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220120130849.292178-1-maximedevos@telenet.be> References: <20220120130849.292178-1-maximedevos@telenet.be> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1642684131; bh=7sjWEY1uigWnXHXrDjfkJlPOHumdUX4dZusyrLHTkZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ffvx/R1utHKCoKPkb6Bo1W7CJunI7QRoHPTHtaC/yk9BJC0rClG2+00uTxDx29GkQ zmWQNA5jJHvut2NsjQ+IjJOWa736HQOEj9gF/03knHSiht5Fl7Tdfj8U462zi4EXn6 74TNG/ayya7Z3mRO0jgU0lHBWG3OekyvWdb1Bx3IAIL+QNgIDAfggfNsiM3tljHNCf evCZ7B3stf5hi18HYTh3NQRQe+2U/EyZptZD2GJx5ohA+yKVlczdOcj7MNXpTRXZYV yHJoVslx+imo22r3tV/lzHsVvT5uNKNla6H2jkogObA8Q2tlBuGQkhZV28gBep5ukf cR1y4Fcim69+w== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1642701955; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=7sjWEY1uigWnXHXrDjfkJlPOHumdUX4dZusyrLHTkZg=; b=K9d5B5OhCnEUVEpYln0Ofq33DGqi1a4dbww5digBgYbaK/hnIYajaLKHq1FU6X7OI6wBLH dYVOc4HZYbmUP422vYrHOQ18/l/19gQw5b9w8Hu1NpDGl7WaZ2oOYLvVg6d379+fSqPTfw vJFQQH0S7ZgMUChYPv22M10ufNTTiNRUhlVSq6W4ELOD2zipBwvd8cTXjuEr9PcO8wIG8f ZotNrvzwTjnLibiT+h6dSDc/Y1V3XyWcdli1B1cQfAdvo+WFe1xgP04BSeswysUNecUyiy vWUd86qpaMMM+iS/g2pXVhdKVipBOmu/3tjyK9lSdd/BRmasPHp7mAEZnNnwZw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642701955; a=rsa-sha256; cv=none; b=l1TQuLlY4uYoDD2Y27tmD9VdkMwJuFNzdmdaVrgZVexnTIlPG05prxijYOFpMRMkd9Gt+k pXUeqhhH9wpuZHmSrU+Otg809aq9FHNLCUco3lb/027nWphrx5QOOyHBz9pLu+KnZDD4fo Ibv+zPP9BKMNg6ClpBFu1hlbubpLQZoiALL4/zl7AFF2eS2hefTMFr2zIR7NO4HCSTr8iV eD49qk4g8fP+FQg0M9IATo/ZYH4Zvx6b+vI+azGE88HmZOcmXyRT/W5/XnR9wWKxXkX0Mn K47rpwYwUJNWE0SW2DaahWylYkACs4zkdyRXqaazeuXEr8ASgTJjKmCe5AZZ4g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r22 header.b="Ffvx/R1u"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.12 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r22 header.b="Ffvx/R1u"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 7E96143EB1 X-Spam-Score: -1.12 X-Migadu-Scanner: scn1.migadu.com X-TUID: himCf59/wgPs Fixes: * tests/import-github.scm (call-with-releases): Run a HTTP server instead of mocking. Suggested-by: Ludovic Courtès --- tests/import-github.scm | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/tests/import-github.scm b/tests/import-github.scm index 979a0fc12b..f6985fac55 100644 --- a/tests/import-github.scm +++ b/tests/import-github.scm @@ -24,30 +24,28 @@ #:use-module (guix http-client) #:use-module (guix import github) #:use-module (guix packages) - #:use-module (guix tests) + #:use-module (guix tests http) #:use-module (guix upstream) + #:use-module (web client) + #:use-module (web request) + #:use-module (web uri) #:use-module (ice-9 match)) (test-begin "github") (define (call-with-releases thunk tags releases) - (mock ((guix http-client) http-fetch - (lambda* (uri #:key headers) - (unless (string-prefix? "mock://" uri) - (error "the URI ~a should not be used" uri)) - (define components - (string-split (substring uri 8) #\/)) - (pk 'stuff components headers) - (define (scm->json-port scm) - (open-input-string (scm->json-string scm))) - (match components - (("repos" "foo" "foomatics" "releases") - (scm->json-port releases)) - (("repos" "foo" "foomatics" "tags") - (scm->json-port tags)) - (rest (error "TODO ~a" rest))))) - (parameterize ((%github-api "mock://")) - (thunk)))) + (with-http-server* + (lambda (request _) + (define resource (uri-path (request-uri request))) + (define components (string-split resource #\/)) + (define json (match components + (("" "repos" "foo" "foomatics" "releases") releases) + (("" "repos" "foo" "foomatics" "tags") tags) + (rest (error "TODO ~a" rest)))) + (values '() (lambda (port) (scm->json json port)))) + (parameterize ((%github-api (%local-url* "")) + (current-http-proxy #false)) + (thunk)))) ;; Copied from tests/minetest.scm (define (upstream-source->sexp upstream-source) -- 2.30.2