From: Timotej Lazar <timotej.lazar@araneo.si>
To: 56563@debbugs.gnu.org
Cc: Timotej Lazar <timotej.lazar@araneo.si>
Subject: [bug#56563] [PATCH v2] gnu: tests: Fix guix-data-service test.
Date: Fri, 15 Jul 2022 07:56:06 +0200 [thread overview]
Message-ID: <20220715055604.4803-1-timotej.lazar@araneo.si> (raw)
In-Reply-To: <20220714192137.23039-1-timotej.lazar@araneo.si>
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))))
--
2.36.1
next prev parent reply other threads:[~2022-07-15 5:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 19:21 [bug#56563] [PATCH] gnu: tests: Fix guix-data-service test Timotej Lazar
2022-07-14 21:26 ` Munyoki Kilyungi
2022-07-15 5:52 ` Timotej Lazar
2022-07-15 8:35 ` Munyoki Kilyungi
2022-07-15 5:56 ` Timotej Lazar [this message]
2022-07-15 9:06 ` bug#56563: [PATCH v2] " Christopher Baines
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220715055604.4803-1-timotej.lazar@araneo.si \
--to=timotej.lazar@araneo.si \
--cc=56563@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).