summary refs log tree commit diff
path: root/nixos/tests/mysql-replication.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/tests/mysql-replication.nix')
-rw-r--r--nixos/tests/mysql-replication.nix15
1 files changed, 7 insertions, 8 deletions
diff --git a/nixos/tests/mysql-replication.nix b/nixos/tests/mysql-replication.nix
index 0cd8c4484bd..b20bce8edce 100644
--- a/nixos/tests/mysql-replication.nix
+++ b/nixos/tests/mysql-replication.nix
@@ -19,12 +19,10 @@ in
         services.mysql.enable = true;
         services.mysql.package = pkgs.mysql;
         services.mysql.replication.role = "master";
+        services.mysql.replication.slaveHost = "%";
+        services.mysql.replication.masterUser = replicateUser;
+        services.mysql.replication.masterPassword = replicatePassword;
         services.mysql.initialDatabases = [ { name = "testdb"; schema = ./testdb.sql; } ];
-        services.mysql.initialScript = pkgs.writeText "initmysql"
-          ''
-            create user '${replicateUser}'@'%' identified by '${replicatePassword}';
-            grant replication slave on *.* to '${replicateUser}'@'%';
-          '';
         networking.firewall.allowedTCPPorts = [ 3306 ];
       };
 
@@ -56,10 +54,11 @@ in
   };
 
   testScript = ''
-    startAll;
-
-    $master->waitForUnit("mysql");
+    $master->start;
     $master->waitForUnit("mysql");
+    $slave1->start;
+    $slave2->start;
+    $slave1->waitForUnit("mysql");
     $slave2->waitForUnit("mysql");
     $slave2->sleep(100); # Hopefully this is long enough!!
     $slave2->succeed("echo 'use testdb; select * from tests' | mysql -u root -N | grep 4");