From: Christopher Baines <mail@cbaines.net>
To: 28399@debbugs.gnu.org
Subject: [bug#28399] [PATCH 2/2] tests: databases: Add a simple test for MySQL.
Date: Sat, 9 Sep 2017 15:53:43 +0100 [thread overview]
Message-ID: <20170909145343.14851-2-mail@cbaines.net> (raw)
In-Reply-To: <20170909145343.14851-1-mail@cbaines.net>
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))))
+
+\f
+;;;
+;;; 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
next prev parent reply other threads:[~2017-09-09 14:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-09 14:39 [bug#28399] [PATCH]: Fix mysql activation, and add a basic test Christopher Baines
2017-09-09 14:53 ` [bug#28399] [PATCH 1/2] services: mysql: Fix missing modules on activation Christopher Baines
2017-09-09 14:53 ` Christopher Baines [this message]
2017-09-11 7:50 ` Ludovic Courtès
2017-09-12 18:48 ` Christopher Baines
2017-09-15 22:02 ` Ludovic Courtès
2017-09-16 10:38 ` Christopher Baines
2017-09-20 9:21 ` Ludovic Courtès
2017-10-08 9:06 ` Christopher Baines
2017-10-08 15:26 ` Ludovic Courtès
2017-10-08 16:34 ` bug#28399: " Christopher Baines
2017-10-08 19:19 ` [bug#28399] " Ludovic Courtès
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=20170909145343.14851-2-mail@cbaines.net \
--to=mail@cbaines.net \
--cc=28399@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).