diff options
author | Christopher Baines <mail@cbaines.net> | 2020-11-29 14:19:55 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-11-29 17:34:18 +0000 |
commit | ff01206345e2306cc633db48e0b29eab9077091a (patch) | |
tree | 25c7ee17005dadc9bf4fae3f0873e03a4704f782 /gnu/tests/databases.scm | |
parent | ed2545f0fa0e2ad99d5a0c45f532c539b299b9fb (diff) | |
parent | 7c2e67400ffaef8eb6f30ef7126c976ee3d7e36c (diff) | |
download | guix-patches-ff01206345e2306cc633db48e0b29eab9077091a.tar guix-patches-ff01206345e2306cc633db48e0b29eab9077091a.tar.gz |
Merge remote-tracking branch 'origin/master' into core-updates
Diffstat (limited to 'gnu/tests/databases.scm')
-rw-r--r-- | gnu/tests/databases.scm | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/gnu/tests/databases.scm b/gnu/tests/databases.scm index e0544bbcd2..31d5ae4c6a 100644 --- a/gnu/tests/databases.scm +++ b/gnu/tests/databases.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Christopher Baines <mail@cbaines.net> +;;; Copyright © 2020 Marius Bakke <marius@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -215,7 +216,9 @@ (define %postgresql-os (simple-operating-system - (service postgresql-service-type))) + (service postgresql-service-type + (postgresql-configuration + (postgresql postgresql-10))))) (define (run-postgresql-test) "Run tests in %POSTGRESQL-OS." @@ -269,7 +272,7 @@ (define %mysql-os (simple-operating-system - (mysql-service))) + (service mysql-service-type))) (define* (run-mysql-test) "Run tests in %MYSQL-OS." @@ -309,6 +312,48 @@ ((pid) (number? pid)))))) 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))))) |