From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esvvy-0007Ny-Qo for guix-patches@gnu.org; Mon, 05 Mar 2018 14:38:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esvvu-00083V-OV for guix-patches@gnu.org; Mon, 05 Mar 2018 14:38:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:38341) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esvvu-000835-KE for guix-patches@gnu.org; Mon, 05 Mar 2018 14:38:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1esvvu-0001WR-3o for guix-patches@gnu.org; Mon, 05 Mar 2018 14:38:02 -0500 Subject: [bug#30701] [PATCH 2/3] tests: databases: Add a system test for PostgreSQL. Resent-Message-ID: From: Christopher Baines Date: Mon, 5 Mar 2018 19:37:18 +0000 Message-Id: <20180305193719.28652-2-mail@cbaines.net> In-Reply-To: <20180305193719.28652-1-mail@cbaines.net> References: <20180305193719.28652-1-mail@cbaines.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30701@debbugs.gnu.org * 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..5c8ca85c1 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)))) +;;; +;;; 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. ;;; -- 2.16.0