mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 13:28:12 -05:00
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. Signed-off-by: Christopher Baines <mail@cbaines.net>
This commit is contained in:
parent
9238ba5874
commit
6a2a8ca1f5
2 changed files with 15 additions and 8 deletions
|
@ -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")
|
||||
|
|
|
@ -222,14 +222,23 @@ (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 5)
|
||||
(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 12))
|
||||
|
||||
(test-end))))
|
||||
|
||||
|
|
Loading…
Reference in a new issue