mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 15:36:20 -05:00
tests: databases: Add a simple test for MySQL.
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.
This commit is contained in:
parent
b36e06c2b0
commit
02bc41c4ce
1 changed files with 60 additions and 1 deletions
|
@ -29,7 +29,8 @@ (define-module (gnu tests databases)
|
|||
#:use-module (guix gexp)
|
||||
#:use-module (guix store)
|
||||
#:export (%test-memcached
|
||||
%test-mongodb))
|
||||
%test-mongodb
|
||||
%test-mysql))
|
||||
|
||||
(define %memcached-os
|
||||
(simple-operating-system
|
||||
|
@ -205,3 +206,61 @@ (define %test-mongodb
|
|||
(name "mongodb")
|
||||
(description "Connect to a running MONGODB server.")
|
||||
(value (run-mongodb-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))))
|
||||
|
|
Loading…
Reference in a new issue