summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.si>2022-07-15 07:56:06 +0200
committerGuix Patches Tester <>2022-07-15 06:58:30 +0100
commitf148ae3cdaefc0e82fe97dfc14002e283b5060d7 (patch)
treee0a1957f795748e64aac721ff142b99a1b2e5d44
parent56136cfc30ebdf0bc32c908bb91d8140eb76ca1a (diff)
downloadguix-patches-f148ae3cdaefc0e82fe97dfc14002e283b5060d7.tar
guix-patches-f148ae3cdaefc0e82fe97dfc14002e283b5060d7.tar.gz
gnu: tests: Fix guix-data-service test.
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.
-rw-r--r--gnu/services/guix.scm2
-rw-r--r--gnu/tests/guix.scm19
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 @@ ca-certificates.crt file in the system profile."
#: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 @@ host all all ::1/128 trust"))))))
((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))))