guix-commits
[Top][All Lists]
Advanced

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

branch master updated: gnu: tests: Fix unbound variable.


From: guix-commits
Subject: branch master updated: gnu: tests: Fix unbound variable.
Date: Sun, 12 Jul 2020 22:24:36 -0400

This is an automated email from the git hooks/post-receive script.

roptat pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new 5cd9cd6  gnu: tests: Fix unbound variable.
5cd9cd6 is described below

commit 5cd9cd644ca493b230cb229e7c46641e94a4e2fa
Author: Julien Lepiller <julien@lepiller.eu>
AuthorDate: Mon Jul 13 04:20:50 2020 +0200

    gnu: tests: Fix unbound variable.
    
    Record type descriptors were made private in
    a143e92446859bd1edc7a7aea85b2089c82c77da, but a usage of them was
    forgotten in the tests files.
    
    * gnu/tests/web.scm (patchwork-initial-database-setup-service): Use
    accessors to access field values instead of unexported type descriptor.
---
 gnu/tests/web.scm | 73 ++++++++++++++++++++++++++++---------------------------
 1 file changed, 37 insertions(+), 36 deletions(-)

diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm
index 1c984dd..7513eab 100644
--- a/gnu/tests/web.scm
+++ b/gnu/tests/web.scm
@@ -521,42 +521,43 @@ HTTP-PORT."
 ;;; Patchwork
 ;;;
 
-(define patchwork-initial-database-setup-service
-  (match-lambda
-    (($ <patchwork-database-configuration>
-        engine name user password host port)
-
-     (define start-gexp
-       #~(lambda ()
-           (let ((pid (primitive-fork))
-                 (postgres (getpwnam "postgres")))
-             (if (eq? pid 0)
-                 (dynamic-wind
-                   (const #t)
-                   (lambda ()
-                     (setgid (passwd:gid postgres))
-                     (setuid (passwd:uid postgres))
-                     (primitive-exit
-                      (if (and
-                           (zero?
-                            (system* #$(file-append postgresql 
"/bin/createuser")
-                                     #$user))
-                           (zero?
-                            (system* #$(file-append postgresql "/bin/createdb")
-                                     "-O" #$user #$name)))
-                          0
-                          1)))
-                   (lambda ()
-                     (primitive-exit 1)))
-                 (zero? (cdr (waitpid pid)))))))
-
-     (shepherd-service
-      (requirement '(postgres))
-      (provision '(patchwork-postgresql-user-and-database))
-      (start start-gexp)
-      (stop #~(const #f))
-      (respawn? #f)
-      (documentation "Setup patchwork database.")))))
+(define (patchwork-initial-database-setup-service configuration)
+  (define start-gexp
+    #~(lambda ()
+        (let ((pid (primitive-fork))
+              (postgres (getpwnam "postgres")))
+          (if (eq? pid 0)
+              (dynamic-wind
+                (const #t)
+                (lambda ()
+                  (setgid (passwd:gid postgres))
+                  (setuid (passwd:uid postgres))
+                  (primitive-exit
+                   (if (and
+                        (zero?
+                         (system* #$(file-append postgresql "/bin/createuser")
+                                  #$(patchwork-database-configuration-user
+                                      configuration)))
+                        (zero?
+                         (system* #$(file-append postgresql "/bin/createdb")
+                                  "-O"
+                                  #$(patchwork-database-configuration-user
+                                      configuration)
+                                  #$(patchwork-database-configuration-name
+                                      configuration))))
+                       0
+                       1)))
+                (lambda ()
+                  (primitive-exit 1)))
+              (zero? (cdr (waitpid pid)))))))
+
+  (shepherd-service
+   (requirement '(postgres))
+   (provision '(patchwork-postgresql-user-and-database))
+   (start start-gexp)
+   (stop #~(const #f))
+   (respawn? #f)
+   (documentation "Setup patchwork database.")))
 
 (define (patchwork-os patchwork)
   (simple-operating-system



reply via email to

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