From patchwork Fri Jul 15 05:56:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timotej Lazar X-Patchwork-Id: 40659 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 EDBF327BBEA; Fri, 15 Jul 2022 06:57:10 +0100 (BST) 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,MAILING_LIST_MULTI,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 B0F7327BBE9 for ; Fri, 15 Jul 2022 06:57:10 +0100 (BST) Received: from localhost ([::1]:57936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oCEK5-0000Nn-Ta for patchwork@mira.cbaines.net; Fri, 15 Jul 2022 01:57:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oCEJy-0000NQ-6u for guix-patches@gnu.org; Fri, 15 Jul 2022 01:57:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41486) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oCEJx-0007DI-U2 for guix-patches@gnu.org; Fri, 15 Jul 2022 01:57:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oCEJx-0002zS-Pf for guix-patches@gnu.org; Fri, 15 Jul 2022 01:57:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56563] [PATCH v2] gnu: tests: Fix guix-data-service test. References: <20220714192137.23039-1-timotej.lazar@araneo.si> In-Reply-To: <20220714192137.23039-1-timotej.lazar@araneo.si> Resent-From: Timotej Lazar Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 15 Jul 2022 05:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56563 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56563@debbugs.gnu.org Cc: Timotej Lazar Received: via spool by 56563-submit@debbugs.gnu.org id=B56563.165786460311466 (code B ref 56563); Fri, 15 Jul 2022 05:57:01 +0000 Received: (at 56563) by debbugs.gnu.org; 15 Jul 2022 05:56:43 +0000 Received: from localhost ([127.0.0.1]:39245 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oCEJe-0002yr-Nh for submit@debbugs.gnu.org; Fri, 15 Jul 2022 01:56:43 -0400 Received: from araneo.si ([90.157.193.204]:43798) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oCEJc-0002yj-Jp for 56563@debbugs.gnu.org; Fri, 15 Jul 2022 01:56:41 -0400 Received: from araneo.si (localhost.lan [127.0.0.1]) by araneo.si (OpenSMTPD) with ESMTP id 99011bd6 for <56563@debbugs.gnu.org>; Fri, 15 Jul 2022 05:56:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=araneo.si; h=from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; s=20180623; bh=py/Lm6wBUMnMFYclW0DqLji77RQ=; b=XxLPEPS21/4PJHtp Wxir6E9P22Dv/kBFvucgvosgeQdQYNykJZn9IOAq8sUc6Bm3y4xK0UsxSrio4qvO 5adihfT2H2lx7poVpXzMDLwV9UQTrHoN652qFSnefZdyVCueHQVpgXUOFKOFDOaC buxVWBlZXpciKUEZH2ADTWG6FWbesX/Soaa63ELmhD5htJ3NMvqOTvz1366R2zlW 6mWGHk9/qxf6acZRiFlZJtSgmLGlnMVHIQqLHQ1X2RCidL+LUCjA7BjcMU95UA4Z kdTBzJJoCfUwkDfMenzM0QcW1F4i1KhpElIvs9FQy8UgNyv9Ru8R3EC4weSHLHgs dRTpkA== Received: by araneo.si (OpenSMTPD) with ESMTPSA id d0d4b2d2 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 15 Jul 2022 05:56:39 +0000 (UTC) From: Timotej Lazar Date: Fri, 15 Jul 2022 07:56:06 +0200 Message-Id: <20220715055604.4803-1-timotej.lazar@araneo.si> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 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 Since revision 32, guix-data-service starts immediately but returns an HTTP error code until initialization is complete. Adjust the test accordingly, and remove the increased startup time limit. * gnu/services/guix.scm (guix-data-service): Use default #:pid-file-timeout. * gnu/tests/guix.scm (guix-data-service): Retry the http-get test several times to give the service time to initialize. --- gnu/services/guix.scm | 2 -- gnu/tests/guix.scm | 19 +++++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/gnu/services/guix.scm b/gnu/services/guix.scm index 338e027245..dac1e5841a 100644 --- a/gnu/services/guix.scm +++ b/gnu/services/guix.scm @@ -652,8 +652,6 @@ (define (guix-data-service-shepherd-services config) #:user #$user #:group #$group #:pid-file "/var/run/guix-data-service/pid" - ;; Allow time for migrations to run - #:pid-file-timeout 120 #:environment-variables `(,(string-append "GUIX_LOCPATH=" #$glibc-utf8-locales "/lib/locale") diff --git a/gnu/tests/guix.scm b/gnu/tests/guix.scm index a4c3e35e5d..02221f4364 100644 --- a/gnu/tests/guix.scm +++ b/gnu/tests/guix.scm @@ -222,14 +222,21 @@ (define marionette ((pid) (number? pid)))))) marionette)) + ;; The service starts immediately but replies with status 500 until + ;; initialization is complete, so keep trying for a while. + (define (try-http-get attempts) + (let ((status (let-values (((response text) + (http-get #$(simple-format + #f "http://localhost:~A/healthcheck" + forwarded-port)))) + (response-code response)))) + (if (or (= status 200) (<= attempts 1)) + status + (begin (sleep 10) (try-http-get (- attempts 1)))))) + (test-equal "http-get" 200 - (let-values - (((response text) - (http-get #$(simple-format - #f "http://localhost:~A/healthcheck" forwarded-port) - #:decode-body? #t))) - (response-code response))) + (try-http-get 10)) (test-end))))