guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

07/08: tests: Avoid starting services to check whether they're running.


From: guix-commits
Subject: 07/08: tests: Avoid starting services to check whether they're running.
Date: Fri, 29 Apr 2022 12:09:40 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 73eeeeafbb0765f76834b53c9fe6cf3c8f740840
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Apr 29 16:43:52 2022 +0200

    tests: Avoid starting services to check whether they're running.
    
    Fixes a regression introduced in the Shepherd 0.9.0 whereby clients can
    start a service that is already being started, leading to two instances
    of the process (and usually failure of the second attempt to start it).
    
    Partly fixes <https://issues.guix.gnu.org/54786>.
    Reported by Mathieu Othacehe.
    
    * gnu/tests/version-control.scm (run-cgit-test)
    ["nginx running", "fcgiwrap running"]: Wail for a file/TCP port instead
    of starting the service.
    (run-git-http-test)["nginx running"]: Likewise.
    (run-gitile-test)["nginx running"]: Likewise.
---
 gnu/tests/version-control.scm | 32 +++++---------------------------
 1 file changed, 5 insertions(+), 27 deletions(-)

diff --git a/gnu/tests/version-control.scm b/gnu/tests/version-control.scm
index fd3dba88ba..18c68a58f2 100644
--- a/gnu/tests/version-control.scm
+++ b/gnu/tests/version-control.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017, 2018 Oleg Pykhalov <go.wigust@gmail.com>
-;;; Copyright © 2017, 2018, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017-2018, 2020-2022 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2018 Christopher Baines <mail@cbaines.net>
 ;;;
@@ -154,19 +154,11 @@ HTTP-PORT."
 
           ;; Wait for nginx to be up and running.
           (test-assert "nginx running"
-            (marionette-eval
-             '(begin
-                (use-modules (gnu services herd))
-                (start-service 'nginx))
-             marionette))
+            (wait-for-file "/var/run/nginx/pid" marionette))
 
           ;; Wait for fcgiwrap to be up and running.
           (test-assert "fcgiwrap running"
-            (marionette-eval
-             '(begin
-                (use-modules (gnu services herd))
-                (start-service 'fcgiwrap))
-             marionette))
+            (wait-for-tcp-port 9000 marionette))
 
           ;; Make sure the PID file is created.
           (test-assert "PID file"
@@ -272,11 +264,7 @@ HTTP-PORT."
 
           ;; Wait for nginx to be up and running.
           (test-assert "nginx running"
-            (marionette-eval
-             '(begin
-                (use-modules (gnu services herd))
-                (start-service 'nginx))
-             marionette))
+            (wait-for-file "/var/run/nginx/pid" marionette))
 
           ;; Make sure Git test repository is created.
           (test-assert "Git test repository"
@@ -486,17 +474,7 @@ HTTP-PORT."
 
           ;; Wait for nginx to be up and running.
           (test-assert "nginx running"
-            (marionette-eval
-             '(begin
-                (use-modules (gnu services herd))
-                (start-service 'nginx))
-             marionette))
-
-          ;; Make sure the PID file is created.
-          (test-assert "PID file"
-            (marionette-eval
-             '(file-exists? "/var/run/nginx/pid")
-             marionette))
+            (wait-for-file "/var/run/nginx/pid" marionette))
 
           ;; Make sure Git test repository is created.
           (test-assert "Git test repository"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]