unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: 30701@debbugs.gnu.org
Subject: [bug#30701] [PATCH 2/3] tests: databases: Add a system test for PostgreSQL.
Date: Mon,  5 Mar 2018 08:39:16 +0000	[thread overview]
Message-ID: <20180305083917.24122-2-mail@cbaines.net> (raw)
In-Reply-To: <20180305083917.24122-1-mail@cbaines.net>

* gnu/tests/databases.scm (%postgresql-os, %test-postgresql): New variables.
  (run-postgresql-test): New procedure.
---
 gnu/tests/databases.scm | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm
index e7097690a..583f484d7 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
@@ -208,6 +209,60 @@
    (value (run-mongodb-test))))
 
 \f
+;;;
+;;; 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-11) (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))))
+
+\f
 ;;;
 ;;; The MySQL service.
 ;;;
-- 
2.16.0

  reply	other threads:[~2018-03-05  8:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-04 19:10 [bug#30701] [PATCH 0/4] PostgreSQL service changes (add record type, and system test) Christopher Baines
2018-03-04 19:16 ` [bug#30701] [PATCH 1/4] services: Rework the PostgreSQL config file to use a record type Christopher Baines
2018-03-04 19:16   ` [bug#30701] [PATCH 2/4] services: Use a external pid file for PostgreSQL Christopher Baines
2018-03-05  0:32     ` Clément Lassieur
2018-03-05  8:21       ` Christopher Baines
2018-03-05  8:27         ` Christopher Baines
2018-03-05 12:15         ` Clément Lassieur
2018-03-04 19:16   ` [bug#30701] [PATCH 3/4] tests: databases: Add a system test " Christopher Baines
2018-03-05  0:32     ` Clément Lassieur
2018-03-05  8:34       ` Christopher Baines
2018-03-04 19:16   ` [bug#30701] [PATCH 4/4] services: databases: Add postgresql-configuration record exports Christopher Baines
2018-03-05 12:16     ` Clément Lassieur
2018-03-05 19:37       ` Christopher Baines
2018-03-05  0:32   ` [bug#30701] [PATCH 1/4] services: Rework the PostgreSQL config file to use a record type Clément Lassieur
2018-03-05  7:52     ` Christopher Baines
2018-03-05  8:52       ` Clément Lassieur
2018-03-05  9:35       ` Clément Lassieur
2018-03-05  8:39 ` [bug#30701] [PATCH 1/3] " Christopher Baines
2018-03-05  8:39   ` Christopher Baines [this message]
2018-03-05 11:54     ` [bug#30701] [PATCH 2/3] tests: databases: Add a system test for PostgreSQL Clément Lassieur
2018-03-05 19:25       ` Christopher Baines
2018-03-05  8:39   ` [bug#30701] [PATCH 3/3] services: databases: Add postgresql-configuration record exports Christopher Baines
2018-03-05 19:37 ` [bug#30701] [PATCH 1/3] services: Rework the PostgreSQL config file to use a record type Christopher Baines
2018-03-05 19:37   ` [bug#30701] [PATCH 2/3] tests: databases: Add a system test for PostgreSQL Christopher Baines
2018-03-05 19:37   ` [bug#30701] [PATCH 3/3] services: databases: Add postgresql-configuration record exports Christopher Baines
2018-03-05 21:33   ` [bug#30701] [PATCH 1/3] services: Rework the PostgreSQL config file to use a record type Clément Lassieur
2018-03-13 17:37     ` bug#30701: " Christopher Baines
2018-03-14 17:37       ` [bug#30701] " Clément Lassieur
2018-03-17 20:35         ` Christopher Baines
2018-03-18  0:34           ` Clément Lassieur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180305083917.24122-2-mail@cbaines.net \
    --to=mail@cbaines.net \
    --cc=30701@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).