From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqh93-0004zp-Mp for guix-patches@gnu.org; Sat, 09 Sep 2017 10:54:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqh90-0005zg-Ke for guix-patches@gnu.org; Sat, 09 Sep 2017 10:54:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:48956) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dqh90-0005zP-Gq for guix-patches@gnu.org; Sat, 09 Sep 2017 10:54:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dqh90-0007VO-2W for guix-patches@gnu.org; Sat, 09 Sep 2017 10:54:02 -0400 Subject: [bug#28399] [PATCH 2/2] tests: databases: Add a simple test for MySQL. Resent-Message-ID: From: Christopher Baines Date: Sat, 9 Sep 2017 15:53:43 +0100 Message-Id: <20170909145343.14851-2-mail@cbaines.net> In-Reply-To: <20170909145343.14851-1-mail@cbaines.net> References: <20170909145343.14851-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: 28399@debbugs.gnu.org Previously, the activation phase for this service caused some systems using it to not boot. This test checks that it's possible to boot a system using it, and at least start the service. * gnu/tests/databases.scm (%mysql-os, %test-mysql): New variables. (run-mysql-test): New procedure. --- gnu/tests/databases.scm | 61 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm index 9d9a75374..6791c561a 100644 --- a/gnu/tests/databases.scm +++ b/gnu/tests/databases.scm @@ -27,7 +27,8 @@ #:use-module (gnu services networking) #:use-module (guix gexp) #:use-module (guix store) - #:export (%test-memcached)) + #:export (%test-memcached + %test-mysql)) (define %memcached-os (simple-operating-system @@ -121,3 +122,61 @@ (name "memcached") (description "Connect to a running MEMCACHED server.") (value (run-memcached-test)))) + + +;;; +;;; The MySQL service. +;;; + +(define %mysql-os + (simple-operating-system + (mysql-service))) + +(define* (run-mysql-test) + "Run tests in %MYSQL-OS." + (define os + (marionette-operating-system + %mysql-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 "mysql") + + (test-assert "service running" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (match (start-service 'mysql) + (#f #f) + (('service response-parts ...) + (match (assq-ref response-parts 'running) + ((pid) (number? pid)))))) + marionette)) + + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + + (gexp->derivation "mysql-test" test)) + +(define %test-mysql + (system-test + (name "mysql") + (description "Start the MySQL service.") + (value (run-mysql-test)))) -- 2.14.1