mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 13:49:23 -05:00
tests: Honor the return value of 'start-service'.
Since commit dc7b3e5633
, 'start-service' returns
the Shepherd's representation of the service as a sexp, and '#f' if the
service fails to start. Also, it doesn't throw an exception when the service
fails to start, so relying on an exception instead of relying on its return
value is a false positive.
* gnu/tests/base.scm (run-nss-mdns-test): Split tests so to check the return
value of 'start-service'.
(run-mcron-test, run-nss-mdns-test): Use 'test-assert' with the return value
of 'start-service'.
* gnu/tests/admin.scm (run-tailon-test): Idem.
* gnu/tests/dict.scm (run-dicod-test): Idem.
* gnu/tests/mail.scm (run-opensmtpd-test, run-exim-test, run-dovecot-test):
Idem.
* gnu/tests/messaging.scm (run-xmpp-test, run-bitlbee-test): Idem.
* gnu/tests/nfs.scm (run-nfs-test): Idem.
* gnu/tests/rsync.scm (run-rsync-test): Idem.
* gnu/tests/ssh.scm (run-ssh-test): Idem.
* gnu/tests/version-control.scm (run-cgit-test, run-git-http-test): Idem.
* gnu/tests/web.scm (run-php-fpm-test): Idem.
This commit is contained in:
parent
14618a1ebb
commit
c24b15472b
10 changed files with 69 additions and 80 deletions
|
@ -1,5 +1,6 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
|
||||
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -74,13 +75,11 @@ (define marionette
|
|||
|
||||
(test-begin "tailon")
|
||||
|
||||
(test-eq "service running"
|
||||
'running!
|
||||
(test-assert "service running"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'tailon)
|
||||
'running!)
|
||||
(start-service 'tailon))
|
||||
marionette))
|
||||
|
||||
(define* (retry-on-error f #:key times delay)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -517,13 +518,11 @@ (define marionette
|
|||
|
||||
(test-begin "mcron")
|
||||
|
||||
(test-eq "service running"
|
||||
'running!
|
||||
(test-assert "service running"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'mcron)
|
||||
'running!)
|
||||
(start-service 'mcron))
|
||||
marionette))
|
||||
|
||||
;; Make sure root's mcron job runs, has its cwd set to "/root", and
|
||||
|
@ -619,32 +618,43 @@ (define marionette
|
|||
|
||||
(test-begin "avahi")
|
||||
|
||||
(test-assert "wait for services"
|
||||
(test-assert "nscd PID file is created"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'nscd))
|
||||
marionette))
|
||||
|
||||
(start-service 'nscd)
|
||||
(test-assert "nscd is listening on its socket"
|
||||
(marionette-eval
|
||||
;; XXX: Work around a race condition in nscd: nscd creates its
|
||||
;; PID file before it is listening on its socket.
|
||||
'(let ((sock (socket PF_UNIX SOCK_STREAM 0)))
|
||||
(let try ()
|
||||
(catch 'system-error
|
||||
(lambda ()
|
||||
(connect sock AF_UNIX "/var/run/nscd/socket")
|
||||
(close-port sock)
|
||||
(format #t "nscd is ready~%")
|
||||
#t)
|
||||
(lambda args
|
||||
(format #t "waiting for nscd...~%")
|
||||
(usleep 500000)
|
||||
(try)))))
|
||||
marionette))
|
||||
|
||||
;; XXX: Work around a race condition in nscd: nscd creates its
|
||||
;; PID file before it is listening on its socket.
|
||||
(let ((sock (socket PF_UNIX SOCK_STREAM 0)))
|
||||
(let try ()
|
||||
(catch 'system-error
|
||||
(lambda ()
|
||||
(connect sock AF_UNIX "/var/run/nscd/socket")
|
||||
(close-port sock)
|
||||
(format #t "nscd is ready~%"))
|
||||
(lambda args
|
||||
(format #t "waiting for nscd...~%")
|
||||
(usleep 500000)
|
||||
(try)))))
|
||||
(test-assert "avahi is running"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'avahi-daemon))
|
||||
marionette))
|
||||
|
||||
;; Wait for the other useful things.
|
||||
(start-service 'avahi-daemon)
|
||||
(start-service 'networking)
|
||||
|
||||
#t)
|
||||
(test-assert "network is up"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'networking))
|
||||
marionette))
|
||||
|
||||
(test-equal "avahi-resolve-host-name"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -84,13 +85,11 @@ (define %dico-socket
|
|||
(test-begin "dicod")
|
||||
|
||||
;; Wait for the service to be started.
|
||||
(test-eq "service is running"
|
||||
'running!
|
||||
(test-assert "service is running"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'dicod)
|
||||
'running!)
|
||||
(start-service 'dicod))
|
||||
marionette))
|
||||
|
||||
;; Wait until dicod is actually listening.
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au>
|
||||
;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
|
||||
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -84,8 +85,7 @@ (define (read-reply-code port)
|
|||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'smtpd)
|
||||
#t)
|
||||
(start-service 'smtpd))
|
||||
marionette))
|
||||
|
||||
(test-assert "mbox is empty"
|
||||
|
@ -224,8 +224,7 @@ (define addr (make-socket-address AF_INET INADDR_LOOPBACK 1025))
|
|||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'exim)
|
||||
#t)
|
||||
(start-service 'exim))
|
||||
marionette))
|
||||
|
||||
(sleep 1) ;; give the service time to start talking
|
||||
|
@ -330,13 +329,11 @@ (define message "From: test@example.com\n\
|
|||
(test-begin "dovecot")
|
||||
|
||||
;; Wait for dovecot to be up and running.
|
||||
(test-eq "dovecot running"
|
||||
'running!
|
||||
(test-assert "dovecot running"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'dovecot)
|
||||
'running!)
|
||||
(start-service 'dovecot))
|
||||
marionette))
|
||||
|
||||
;; Check Dovecot service's PID.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
|
||||
;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
|
||||
;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
|
@ -102,13 +102,11 @@ (define (host-wait-for-file file)
|
|||
(test-begin "xmpp")
|
||||
|
||||
;; Wait for XMPP service to be up and running.
|
||||
(test-eq "service running"
|
||||
'running!
|
||||
(test-assert "service running"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'xmpp-daemon)
|
||||
'running!)
|
||||
(start-service 'xmpp-daemon))
|
||||
marionette))
|
||||
|
||||
;; Check XMPP service's PID.
|
||||
|
@ -196,13 +194,11 @@ (define marionette
|
|||
|
||||
(test-begin "bitlbee")
|
||||
|
||||
(test-eq "service started"
|
||||
'running!
|
||||
(test-assert "service started"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'bitlbee)
|
||||
'running!)
|
||||
(start-service 'bitlbee))
|
||||
marionette))
|
||||
|
||||
(test-equal "valid PID"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
;;; Copyright © 2016 John Darrington <jmd@gnu.org>
|
||||
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
|
||||
;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
|
||||
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -94,13 +95,11 @@ (define (wait-for-socket file)
|
|||
(test-begin "rpc-daemon")
|
||||
|
||||
;; Wait for the rpcbind daemon to be up and running.
|
||||
(test-eq "RPC service running"
|
||||
'running!
|
||||
(test-assert "RPC service running"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'rpcbind-daemon)
|
||||
'running!)
|
||||
(start-service 'rpcbind-daemon))
|
||||
marionette))
|
||||
|
||||
;; Check the socket file and that the service is still running.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
|
||||
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -59,13 +60,11 @@ (define marionette
|
|||
(test-begin "rsync")
|
||||
|
||||
;; Wait for rsync to be up and running.
|
||||
(test-eq "service running"
|
||||
'running!
|
||||
(test-assert "service running"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'rsync)
|
||||
'running!)
|
||||
(start-service 'rsync))
|
||||
marionette))
|
||||
|
||||
;; Make sure the PID file is created.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
|
||||
;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
|
||||
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
|
@ -111,13 +111,11 @@ (define (call-with-connected-session/auth proc)
|
|||
(test-begin "ssh-daemon")
|
||||
|
||||
;; Wait for sshd to be up and running.
|
||||
(test-eq "service running"
|
||||
'running!
|
||||
(test-assert "service running"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'ssh-daemon)
|
||||
'running!)
|
||||
(start-service 'ssh-daemon))
|
||||
marionette))
|
||||
|
||||
;; Check sshd's PID file.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2017, 2018 Oleg Pykhalov <go.wigust@gmail.com>
|
||||
;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
|
||||
;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -147,23 +147,19 @@ (define marionette
|
|||
marionette))
|
||||
|
||||
;; Wait for nginx to be up and running.
|
||||
(test-eq "nginx running"
|
||||
'running!
|
||||
(test-assert "nginx running"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'nginx)
|
||||
'running!)
|
||||
(start-service 'nginx))
|
||||
marionette))
|
||||
|
||||
;; Wait for fcgiwrap to be up and running.
|
||||
(test-eq "fcgiwrap running"
|
||||
'running!
|
||||
(test-assert "fcgiwrap running"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'fcgiwrap)
|
||||
'running!)
|
||||
(start-service 'fcgiwrap))
|
||||
marionette))
|
||||
|
||||
;; Make sure the PID file is created.
|
||||
|
@ -272,13 +268,11 @@ (define marionette
|
|||
(test-begin "git-http")
|
||||
|
||||
;; Wait for nginx to be up and running.
|
||||
(test-eq "nginx running"
|
||||
'running!
|
||||
(test-assert "nginx running"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'nginx)
|
||||
'running!)
|
||||
(start-service 'nginx))
|
||||
marionette))
|
||||
|
||||
;; Make sure Git test repository is created.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
|
||||
;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
|
||||
;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
|
||||
;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
|
@ -245,13 +245,11 @@ (define marionette
|
|||
((pid) (number? pid))))))
|
||||
marionette))
|
||||
|
||||
(test-eq "nginx running"
|
||||
'running!
|
||||
(test-assert "nginx running"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (gnu services herd))
|
||||
(start-service 'nginx)
|
||||
'running!)
|
||||
(start-service 'nginx))
|
||||
marionette))
|
||||
|
||||
(test-equal "http-get"
|
||||
|
|
Loading…
Reference in a new issue