civodul pushed a commit to branch master
in repository guix.

commit 57c7e46d391bea11cacf44f9743c721c070bd3a8
Author: Ludovic Courtès <[email protected]>
Date:   Fri Jul 29 11:07:00 2016 +0200

    tests: Improve synchronization in 'tests/guix-register.sh'.
    
    * tests/guix-register.sh: When launching guix-daemon, add retry loop
    around 'open-connection'.  This fixes test failures that could occur
    under heavy load where the daemon's socket file wouldn't be ready yet
    when the client connects.
---
 tests/guix-register.sh |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/tests/guix-register.sh b/tests/guix-register.sh
index 360cf55..521735b 100644
--- a/tests/guix-register.sh
+++ b/tests/guix-register.sh
@@ -1,5 +1,5 @@
 # GNU Guix --- Functional package management for GNU
-# Copyright © 2013, 2014, 2015 Ludovic Courtès <[email protected]>
+# Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <[email protected]>
 #
 # This file is part of GNU Guix.
 #
@@ -157,8 +157,20 @@ do
     # that name in a 'valid-path?' query because 'assertStorePath' would kill
     # us because of the wrong prefix.  So we just list dead paths instead.
     guile -c "
-      (use-modules (guix store) (srfi srfi-1))
-      (define s (open-connection \"$GUIX_DAEMON_SOCKET\"))
+      (use-modules (guix store) (srfi srfi-1) (srfi srfi-34))
+
+      (define s
+        (let loop ((i 5))
+          (guard (c ((nix-connection-error? c)
+                     (if (<= i 0)
+                         (raise c)
+                         (begin
+                           (display \"waiting for daemon socket...\")
+                           (newline)
+                           (sleep 1)
+                           (loop (- i 1))))))
+             (open-connection \"$GUIX_DAEMON_SOCKET\"))))
+
       (exit (lset= string=?
                    (pk 1 (list \"$copied\" \"$copied_duplicate1\"
                                \"$copied_duplicate2\"))

Reply via email to