mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
services: MySQL: Add more tests.
* gnu/tests/databases.scm (run-mysql-test): Try creating a database and inserting data.
This commit is contained in:
parent
e20388ad7f
commit
97c4fd21bd
1 changed files with 39 additions and 0 deletions
|
@ -315,6 +315,45 @@ (define marionette
|
|||
(test-assert "mysql_upgrade completed"
|
||||
(wait-for-file "/var/lib/mysql/mysql_upgrade_info" marionette))
|
||||
|
||||
(test-eq "create database"
|
||||
0
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(system* #$(file-append mariadb "/bin/mysql")
|
||||
"-e" "CREATE DATABASE guix;"))
|
||||
marionette))
|
||||
|
||||
(test-eq "create table"
|
||||
0
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(system*
|
||||
#$(file-append mariadb "/bin/mysql") "guix"
|
||||
"-e" "CREATE TABLE facts (id INT, data VARCHAR(12));"))
|
||||
marionette))
|
||||
|
||||
(test-eq "insert data"
|
||||
0
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(system* #$(file-append mariadb "/bin/mysql") "guix"
|
||||
"-e" "INSERT INTO facts VALUES (1, 'awesome')"))
|
||||
marionette))
|
||||
|
||||
(test-equal "retrieve data"
|
||||
"awesome\n"
|
||||
(marionette-eval
|
||||
'(begin
|
||||
(use-modules (ice-9 popen))
|
||||
(let* ((port (open-pipe*
|
||||
OPEN_READ
|
||||
#$(file-append mariadb "/bin/mysql") "guix"
|
||||
"-NB" "-e" "SELECT data FROM facts WHERE id=1;"))
|
||||
(output (get-string-all port)))
|
||||
(close-pipe port)
|
||||
output))
|
||||
marionette))
|
||||
|
||||
(test-end)
|
||||
(exit (= (test-runner-fail-count (test-runner-current)) 0)))))
|
||||
|
||||
|
|
Loading…
Reference in a new issue