t/pt-table-sync/wait.t: use wait_until() instead of sleep()

This commit is contained in:
Brian Fraser
2012-07-23 13:48:05 -03:00
parent a948014991
commit 0d26097f31

View File

@@ -61,15 +61,13 @@ if ( !$pid ) {
}
# parent
sleep 4; # give time slave to become lagged
my $lag = $slave_dbh->selectrow_hashref("show slave status");
if ( !$lag->{seconds_behind_master} ) {
PerconaTest::wait_until(sub {
$slave_dbh->selectrow_hashref("show slave status")->{seconds_behind_master}
}) or do {
kill 15, $pid;
waitpid ($pid, 0);
die "Slave did not lag";
}
};
my $start = time;
@@ -93,14 +91,13 @@ cmp_ok(
);
# Repeat the test with --wait 0 to test that the sync happens without delay.
$lag = $slave_dbh->selectrow_hashref("show slave status");
if ( !$lag->{seconds_behind_master} ) {
PerconaTest::wait_until(sub {
$slave_dbh->selectrow_hashref("show slave status")->{seconds_behind_master}
}) or do {
kill 15, $pid;
waitpid ($pid, 0);
die "Slave is not lagged";
}
die "Slave did not lag";
};
$start = time;