summary refs log tree commit diff
path: root/nixos/tests/mysql.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/tests/mysql.nix')
-rw-r--r--nixos/tests/mysql.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/nixos/tests/mysql.nix b/nixos/tests/mysql.nix
new file mode 100644
index 000000000000..b48850738b72
--- /dev/null
+++ b/nixos/tests/mysql.nix
@@ -0,0 +1,22 @@
+{ pkgs, ... }:
+
+{
+  nodes = {
+    master =
+      { pkgs, config, ... }:
+
+      {
+        services.mysql.enable = true;
+	services.mysql.replication.role = "master";
+	services.mysql.initialDatabases = [ { name = "testdb"; schema = ./testdb.sql; } ];
+      };
+  };
+
+  testScript = ''
+    startAll;
+
+    $master->waitForUnit("mysql");
+    $master->sleep(10); # Hopefully this is long enough!!
+    $master->succeed("echo 'use testdb; select * from tests' | mysql -u root -N | grep 4");
+  '';
+}