tests: Cgit test waits for /var/run/shepherd/socket.

Previously tests sometimes start before the shepherd was listening,
leading to test failures.

* gnu/tests/version-control.scm (run-cgit-test)[test]: Add "shepherd
socket ready" test.  Rename to two "service running" tests for clarity.
This commit is contained in:
Ludovic Courtès 2018-01-21 00:16:48 +01:00
parent 33033a620e
commit bc58201ec2
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 20 additions and 3 deletions

View File

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
;;;
;;; This file is part of GNU Guix.
@ -130,8 +130,25 @@ HTTP-PORT."
(test-begin "cgit")
;; XXX: Shepherd reads the config file *before* binding its control
;; socket, so /var/run/shepherd/socket might not exist yet when the
;; 'marionette' service is started.
(test-assert "shepherd socket ready"
(marionette-eval
`(begin
(use-modules (gnu services herd))
(let loop ((i 10))
(cond ((file-exists? (%shepherd-socket-file))
#t)
((> i 0)
(sleep 1)
(loop (- i 1)))
(else
'failure))))
marionette))
;; Wait for nginx to be up and running.
(test-eq "service running"
(test-eq "nginx running"
'running!
(marionette-eval
'(begin
@ -141,7 +158,7 @@ HTTP-PORT."
marionette))
;; Wait for fcgiwrap to be up and running.
(test-eq "service running"
(test-eq "fcgiwrap running"
'running!
(marionette-eval
'(begin