summary refs log tree commit diff
path: root/nixos/tests/mysql-replication.nix
diff options
context:
space:
mode:
authorben smith <polynomial@users.noreply.github.com>2016-07-22 15:37:05 -0700
committerRok Garbas <rok@garbas.si>2016-07-23 00:37:05 +0200
commitc38e6a2a6060434d842f173ebe5a4a7d4d99781a (patch)
treecd90903c64af83649703d81595f929b10605c5e1 /nixos/tests/mysql-replication.nix
parente8343fbb3882e932d23af6141d00a195528cc0b0 (diff)
downloadnixlib-c38e6a2a6060434d842f173ebe5a4a7d4d99781a.tar
nixlib-c38e6a2a6060434d842f173ebe5a4a7d4d99781a.tar.gz
nixlib-c38e6a2a6060434d842f173ebe5a4a7d4d99781a.tar.bz2
nixlib-c38e6a2a6060434d842f173ebe5a4a7d4d99781a.tar.lz
nixlib-c38e6a2a6060434d842f173ebe5a4a7d4d99781a.tar.xz
nixlib-c38e6a2a6060434d842f173ebe5a4a7d4d99781a.tar.zst
nixlib-c38e6a2a6060434d842f173ebe5a4a7d4d99781a.zip
mysql: fix replication tests (#17174)
Eliminate race condition in replication test
Remove replication configuration from standalone test
Improve mysql command syntax consistency
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 0cd8c4484bd7..b20bce8edce6 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");