summary refs log tree commit diff
path: root/gnu/tests
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2021-01-18 10:52:25 +0100
committerMathieu Othacehe <othacehe@gnu.org>2021-01-28 12:57:26 +0100
commitfe4b8823505c3271fc3eacaa93c30a5cec078739 (patch)
treedd44ac59eb678e36265b25a74929ae0031c8885b /gnu/tests
parent6c0679215f4ffa534c1eb2e8c8a6e043a0c993fe (diff)
downloadguix-fe4b8823505c3271fc3eacaa93c30a5cec078739.tar.gz
services: postgresql: Add log directory support.
* gnu/services/databases.scm (postgresql-configuration-log-directory): New
procedure.
(<postgresql-configuration>)[log-directory]: New field.
(postgresql-activation): Create the log directory.
(postgresql-shepherd-service): Honor it.
* gnu/tests/databases.scm (%postgresql-log-directory): New variable.
(log-file): New test case.
* doc/guix.texi (Database Services): Document it.
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/databases.scm20
1 files changed, 20 insertions, 0 deletions
diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm
index 7338007919..d881a8c3ee 100644
--- a/gnu/tests/databases.scm
+++ b/gnu/tests/databases.scm
@@ -214,6 +214,9 @@
 ;;; The PostgreSQL service.
 ;;;
 
+(define %postgresql-log-directory
+  "/var/log/postgresql")
+
 (define %postgresql-os
   (simple-operating-system
    (service postgresql-service-type
@@ -262,6 +265,23 @@
                 (start-service 'postgres))
              marionette))
 
+          (test-assert "log-file"
+            (marionette-eval
+             '(begin
+                (use-modules (ice-9 ftw)
+                             (ice-9 match))
+                (current-output-port
+                 (open-file "/dev/console" "w0"))
+                (let ((server-log-file
+                       (string-append #$%postgresql-log-directory
+                                      "/pg_ctl.log")))
+                  (and (file-exists? server-log-file)
+                       (display
+                        (call-with-input-file server-log-file
+                          get-string-all)))
+                  #t))
+             marionette))
+
           (test-end)
           (exit (= (test-runner-fail-count (test-runner-current)) 0)))))