mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-19 17:04:00 +00:00
t/pt-table-sync/wait.t: use wait_until() instead of sleep()
This commit is contained in:
@@ -61,15 +61,13 @@ if ( !$pid ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# parent
|
# parent
|
||||||
sleep 4; # give time slave to become lagged
|
PerconaTest::wait_until(sub {
|
||||||
|
$slave_dbh->selectrow_hashref("show slave status")->{seconds_behind_master}
|
||||||
my $lag = $slave_dbh->selectrow_hashref("show slave status");
|
}) or do {
|
||||||
|
|
||||||
if ( !$lag->{seconds_behind_master} ) {
|
|
||||||
kill 15, $pid;
|
kill 15, $pid;
|
||||||
waitpid ($pid, 0);
|
waitpid ($pid, 0);
|
||||||
die "Slave did not lag";
|
die "Slave did not lag";
|
||||||
}
|
};
|
||||||
|
|
||||||
my $start = time;
|
my $start = time;
|
||||||
|
|
||||||
@@ -93,14 +91,13 @@ cmp_ok(
|
|||||||
);
|
);
|
||||||
|
|
||||||
# Repeat the test with --wait 0 to test that the sync happens without delay.
|
# Repeat the test with --wait 0 to test that the sync happens without delay.
|
||||||
|
PerconaTest::wait_until(sub {
|
||||||
$lag = $slave_dbh->selectrow_hashref("show slave status");
|
$slave_dbh->selectrow_hashref("show slave status")->{seconds_behind_master}
|
||||||
|
}) or do {
|
||||||
if ( !$lag->{seconds_behind_master} ) {
|
|
||||||
kill 15, $pid;
|
kill 15, $pid;
|
||||||
waitpid ($pid, 0);
|
waitpid ($pid, 0);
|
||||||
die "Slave is not lagged";
|
die "Slave did not lag";
|
||||||
}
|
};
|
||||||
|
|
||||||
$start = time;
|
$start = time;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user