From patchwork Thu Jan 20 13:08:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: M X-Patchwork-Id: 36649 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 974D927BBEA; Thu, 20 Jan 2022 19:37:46 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5B62527BBE9 for ; Thu, 20 Jan 2022 19:37:46 +0000 (GMT) Received: from localhost ([::1]:47442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nAdFh-00041w-Ha for patchwork@mira.cbaines.net; Thu, 20 Jan 2022 14:37:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAXBb-00042T-3F for guix-patches@gnu.org; Thu, 20 Jan 2022 08:09:09 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35557) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nAXBW-0004Kq-O9 for guix-patches@gnu.org; Thu, 20 Jan 2022 08:09:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nAXBW-0004qT-KA for guix-patches@gnu.org; Thu, 20 Jan 2022 08:09:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53389] [PATCH 2/9] tests: Generalise %local-url. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 20 Jan 2022 13:09:02 +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.164268413718608 (code B ref 53389); Thu, 20 Jan 2022 13:09:02 +0000 Received: (at 53389) by debbugs.gnu.org; 20 Jan 2022 13:08:57 +0000 Received: from localhost ([127.0.0.1]:56690 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nAXBR-0004q2-IG for submit@debbugs.gnu.org; Thu, 20 Jan 2022 08:08:57 -0500 Received: from baptiste.telenet-ops.be ([195.130.132.51]:41992) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nAXBM-0004oq-06 for 53389@debbugs.gnu.org; Thu, 20 Jan 2022 08:08:53 -0500 Received: from localhost.localdomain ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by baptiste.telenet-ops.be with bizsmtp id l18q2600H4UW6Th0118qNC; Thu, 20 Jan 2022 14:08:51 +0100 From: Maxime Devos Date: Thu, 20 Jan 2022 13:08:42 +0000 Message-Id: <20220120130849.292178-2-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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1642684131; bh=LLNXnyxA1ztljqORkcELY3W31H0beEK/duEXvgn61Iw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=E0uoBdnbuyrhKj5k9590w7uC/piTTB2xW82ykvNLASd9MNqenjI7pB1Zt1fpyfIUh TFPAW1XTrHTfNOTl1jk7BuUQrH6pFvZqQdLBCC0cX4OYNhMVUa1pnMQAfKBP23/ypY PBc1J5V35m/QR3daA+Cj3Qyoc8muDceZWEz5sj/QeaIdK+XfYcYMV7FdTfowrPEYgX aUMCLpsVzkKmfiUhXHh0y6WQvLS4SDjDco+AZJkelp88OpRhnaCPalr3sYprf0Bp+O HKAJhgFKUDj4Lh+238ZFFRF9K23ZHDB4MrD8akLrNSVkKJ6rBhf+XcT7WjnbtTBA/3 tcM8LWdv2jRJg== 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/tests/http.scm (%local-url): Extract most functionality to ... (%local-url*): ... here and don't hardcode "/foo/bar". --- guix/tests/http.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/guix/tests/http.scm b/guix/tests/http.scm index c42b4b8176..2f65df4029 100644 --- a/guix/tests/http.scm +++ b/guix/tests/http.scm @@ -31,6 +31,7 @@ call-with-http-server call-with-http-server* %http-server-port + %local-url* %local-url)) ;;; Commentary: @@ -64,12 +65,14 @@ actually listened at (in case %http-server-port was 0)." (strerror err)) (values #f #f))))) -(define* (%local-url #:optional (port (%http-server-port))) +(define* (%local-url* resource #:optional (port (%http-server-port))) + ;; The URL to the resource named RESOURCE on the current HTTP server. (when (= port 0) (error "no web server is running!")) + (string-append "http://localhost:" (number->string port) resource)) +(define* (%local-url #:optional (port (%http-server-port))) ;; URL to use for 'home-page' tests. - (string-append "http://localhost:" (number->string port) - "/foo/bar")) + (%local-url* "/foo/bar" port)) (define* (call-with-http-server* handle thunk #:key (keep-lingering? #false) (last-response? (const #false)))