GNU bug report logs -
#28399
[PATCH]: Fix mysql activation, and add a basic test.
Previous Next
Reported by: Christopher Baines <mail <at> cbaines.net>
Date: Sat, 9 Sep 2017 14:40:01 UTC
Severity: normal
Tags: patch
Done: Christopher Baines <mail <at> cbaines.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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
This bug report was last modified 7 years and 231 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.