summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorxeji <36407913+xeji@users.noreply.github.com>2018-05-22 01:22:12 +0200
committerGitHub <noreply@github.com>2018-05-22 01:22:12 +0200
commitfe79fc0be4f3e27d634fbcb27c43eed948d285ce (patch)
treeff35547592b398c31714d80be9a01fa7640cc3f6 /nixos
parent050d07d6726ca650599af9108fb7ed0977caa152 (diff)
downloadnixpkgs-fe79fc0be4f3e27d634fbcb27c43eed948d285ce.tar
nixpkgs-fe79fc0be4f3e27d634fbcb27c43eed948d285ce.tar.gz
nixpkgs-fe79fc0be4f3e27d634fbcb27c43eed948d285ce.tar.bz2
nixpkgs-fe79fc0be4f3e27d634fbcb27c43eed948d285ce.tar.lz
nixpkgs-fe79fc0be4f3e27d634fbcb27c43eed948d285ce.tar.xz
nixpkgs-fe79fc0be4f3e27d634fbcb27c43eed948d285ce.tar.zst
nixpkgs-fe79fc0be4f3e27d634fbcb27c43eed948d285ce.zip
nixos/tests/mysql-replication: fix test (#40850)
Failed non-deterministically on hydra because replcation
sometimes was not finished yet when checking the results.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/mysql-replication.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/nixos/tests/mysql-replication.nix b/nixos/tests/mysql-replication.nix
index 75c6d793feb..ed09ac10b75 100644
--- a/nixos/tests/mysql-replication.nix
+++ b/nixos/tests/mysql-replication.nix
@@ -57,18 +57,25 @@ in
     $master->start;
     $master->waitForUnit("mysql");
     $master->waitForOpenPort(3306);
+    # Wait for testdb to be fully populated (5 rows).
+    $master->waitUntilSucceeds("mysql -u root -D testdb -N -B -e 'select count(id) from tests' | grep -q 5");
+
     $slave1->start;
     $slave2->start;
     $slave1->waitForUnit("mysql");
     $slave1->waitForOpenPort(3306);
     $slave2->waitForUnit("mysql");
     $slave2->waitForOpenPort(3306);
-    $slave2->succeed("echo 'use testdb; select * from tests' | mysql -u root -N | grep 4");
+
+    # wait for replications to finish
+    $slave1->waitUntilSucceeds("mysql -u root -D testdb -N -B -e 'select count(id) from tests' | grep -q 5");
+    $slave2->waitUntilSucceeds("mysql -u root -D testdb -N -B -e 'select count(id) from tests' | grep -q 5");
+
     $slave2->succeed("systemctl stop mysql");
     $master->succeed("echo 'insert into testdb.tests values (123, 456);' | mysql -u root -N");
     $slave2->succeed("systemctl start mysql");
     $slave2->waitForUnit("mysql");
     $slave2->waitForOpenPort(3306);
-    $slave2->succeed("echo 'select * from testdb.tests where Id = 123;' | mysql -u root -N | grep 456");
+    $slave2->waitUntilSucceeds("echo 'select * from testdb.tests where Id = 123;' | mysql -u root -N | grep 456");
   '';
 })