aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-02-09 08:17:58 +0000
committerChristopher Baines <mail@cbaines.net>2018-03-10 16:20:55 +0000
commit69f7cf2bf4ca3ab792438a9e7fb46f78ef0f227a (patch)
tree5821d14ea9722eeef013d5543d5992eb568c14a3
parent936e7a5245d5b50be8b968b39760220066ae24f5 (diff)
downloadguix-69f7cf2bf4ca3ab792438a9e7fb46f78ef0f227a.tar.gz
guix-69f7cf2bf4ca3ab792438a9e7fb46f78ef0f227a.zip
tests: databases: Add a system test for PostgreSQL.
* gnu/tests/databases.scm (%postgresql-os, %test-postgresql): New variables. (run-postgresql-test): New procedure.
-rw-r--r--gnu/tests/databases.scm55
1 files changed, 55 insertions, 0 deletions
diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm
index e7097690a0..5c8ca85c13 100644
--- a/gnu/tests/databases.scm
+++ b/gnu/tests/databases.scm
@@ -30,6 +30,7 @@
#:use-module (guix store)
#:export (%test-memcached
%test-mongodb
+ %test-postgresql
%test-mysql))
(define %memcached-os
@@ -209,6 +210,60 @@
;;;
+;;; The PostgreSQL service.
+;;;
+
+(define %postgresql-os
+ (simple-operating-system
+ (service postgresql-service-type)))
+
+(define (run-postgresql-test)
+ "Run tests in %POSTGRESQL-OS."
+ (define os
+ (marionette-operating-system
+ %postgresql-os
+ #:imported-modules '((gnu services herd)
+ (guix combinators))))
+
+ (define vm
+ (virtual-machine
+ (operating-system os)
+ (memory-size 512)))
+
+ (define test
+ (with-imported-modules '((gnu build marionette))
+ #~(begin
+ (use-modules (srfi srfi-64)
+ (gnu build marionette))
+
+ (define marionette
+ (make-marionette (list #$vm)))
+
+ (mkdir #$output)
+ (chdir #$output)
+
+ (test-begin "postgresql")
+
+ (test-assert "service running"
+ (marionette-eval
+ '(begin
+ (use-modules (gnu services herd))
+ (start-service 'postgres))
+ marionette))
+
+ (test-end)
+ (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
+
+ (gexp->derivation "postgresql-test" test))
+
+(define %test-postgresql
+ (system-test
+ (name "postgresql")
+ (description "Start the PostgreSQL service.")
+ (value (run-postgresql-test))))
+
+
+;;;
;;; The MySQL service.
;;;