GNU bug report logs -
#56563
[PATCH] gnu: tests: Fix guix-data-service test.
Previous Next
Reported by: Timotej Lazar <timotej.lazar <at> araneo.si>
Date: Thu, 14 Jul 2022 19:23:02 UTC
Severity: normal
Tags: patch
Done: Christopher Baines <mail <at> cbaines.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Fri, 15 Jul 2022 10:06:20 +0100
with message-id <87y1wug2w5.fsf <at> cbaines.net>
and subject line Re: [bug#56563] [PATCH v2] gnu: tests: Fix guix-data-service test.
has caused the debbugs.gnu.org bug report #56563,
regarding [PATCH] gnu: tests: Fix guix-data-service test.
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
56563: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56563
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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))))
--
2.36.1
[Message part 3 (message/rfc822, inline)]
[Message part 4 (text/plain, inline)]
Timotej Lazar <timotej.lazar <at> araneo.si> writes:
> 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(-)
>
Thanks Timotej, I've pushed this as
a15b769c2f81034884ef0ae7fa8c1cea8df45c56.
I've also updated the data service so that it responds with a 503 for
the healthcheck when starting up, rather than a 500, as that's a bit
nicer.
Chris
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 2 years and 310 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.