From fe4b8823505c3271fc3eacaa93c30a5cec078739 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Mon, 18 Jan 2021 10:52:25 +0100 Subject: services: postgresql: Add log directory support. * gnu/services/databases.scm (postgresql-configuration-log-directory): New procedure. ()[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. --- gnu/tests/databases.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'gnu/tests') 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))))) -- cgit 1.4.1