From patchwork Thu Jul 14 19:21:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timotej Lazar X-Patchwork-Id: 3716 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 6ADD427BBEA; Thu, 14 Jul 2022 20:23:16 +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 29BB827BBE9 for ; Thu, 14 Jul 2022 20:23:16 +0100 (BST) Received: from localhost ([::1]:44112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oC4Qd-0006F4-An for patchwork@mira.cbaines.net; Thu, 14 Jul 2022 15:23:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oC4QQ-0006Dx-Vq for guix-patches@gnu.org; Thu, 14 Jul 2022 15:23:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41164) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oC4QQ-000759-Me for guix-patches@gnu.org; Thu, 14 Jul 2022 15:23:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oC4QQ-0003KF-Ha for guix-patches@gnu.org; Thu, 14 Jul 2022 15:23:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56563] [PATCH] gnu: tests: Fix guix-data-service test. Resent-From: Timotej Lazar Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 14 Jul 2022 19:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56563 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56563@debbugs.gnu.org Cc: Timotej Lazar X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165782653312706 (code B ref -1); Thu, 14 Jul 2022 19:23:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Jul 2022 19:22:13 +0000 Received: from localhost ([127.0.0.1]:38923 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oC4Pb-0003Iq-70 for submit@debbugs.gnu.org; Thu, 14 Jul 2022 15:22:13 -0400 Received: from lists.gnu.org ([209.51.188.17]:58138) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oC4PW-0003If-Fs for submit@debbugs.gnu.org; Thu, 14 Jul 2022 15:22:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oC4PW-0005DS-BN for guix-patches@gnu.org; Thu, 14 Jul 2022 15:22:06 -0400 Received: from araneo.si ([2001:15c0:2110:3400::2]:44826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oC4PU-0005UP-L9 for guix-patches@gnu.org; Thu, 14 Jul 2022 15:22:06 -0400 Received: from araneo.si (localhost.lan [127.0.0.1]) by araneo.si (OpenSMTPD) with ESMTP id 89201200 for ; Thu, 14 Jul 2022 19:21:59 +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=7rz4RIbX8y30JuyjFT4DY/E1MuU=; b=EEc+ZYGuAaMPoDb8 VSWB/byQOGgY8O0K2mjjBl0iUsbQiLRNvP/hileZamurNbjP2DssgcldNQzc9Ruo IzrkDhy9LzY6vTgmyevIqxuw82+iHI/y3OK3Fqdi1ty3t9+OKE4V/7RuaslzwUQU FxK/isF3omNQasjZKcK79y7JZjAXGQ9ScgDUOaXgeDZu8pwwdXzBF07N8uPy+spw umsvLY8sK8qNGq1zkRR7NcOViU4tS1cJ/7JOXu4HNpLaiGfzwE821elArVp0OBXU K2NwWtKG5yuDFNlVcNPoDMm2fwgakL0nzjGCTPWKoYyE+1QoKFBoNtYgkvrFf6P/ 4gOJbA== Received: by araneo.si (OpenSMTPD) with ESMTPSA id 70c4296b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 14 Jul 2022 19:21:59 +0000 (UTC) From: Timotej Lazar Date: Thu, 14 Jul 2022 21:21:38 +0200 Message-Id: <20220714192137.23039-1-timotej.lazar@araneo.si> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2001:15c0:2110:3400::2; envelope-from=timotej.lazar@araneo.si; helo=araneo.si X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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..ce62f74b60 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))))