Stabilize some pt-kill tests.

This commit is contained in:
Daniel Nichter
2012-07-12 17:26:54 -06:00
parent 4430cfabb5
commit 554bd01f41
2 changed files with 5 additions and 4 deletions

View File

@@ -47,6 +47,7 @@ diag(`rm $out`);
SKIP: {
skip 'Cannot connect to sandbox master', 2 unless $master_dbh;
$master_dbh->do("CREATE DATABASE IF NOT EXISTS pt_kill_zombie_test");
system "/tmp/12345/use -e 'select sleep(2)' >/dev/null 2>&1 &";
@@ -70,7 +71,7 @@ SKIP: {
diag(`rm $out`);
# Don't make zombies (https://bugs.launchpad.net/percona-toolkit/+bug/919819)
system "/tmp/12345/use -e 'select sleep(2)' >/dev/null 2>&1 &";
$master_dbh->do("USE pt_kill_zombie_test");
my $sentinel = "/tmp/pt-kill-test.$PID.stop";
my $pid_file = "/tmp/pt-kill-test.$PID.pid";
@@ -79,8 +80,8 @@ SKIP: {
diag(`rm $pid_file 2>/dev/null`);
diag(`rm $log_file 2>/dev/null`);
`$cmd --daemonize --match-info 'select sleep' --interval 1 --print --execute-command 'echo zombie > $out' --verbose --pid $pid_file --log $log_file --sentinel $sentinel`;
sleep 1;
`$cmd --daemonize --match-db pt_kill_zombie_test --interval 1 --print --execute-command 'echo zombie > $out' --verbose --pid $pid_file --log $log_file --sentinel $sentinel`;
PerconaTest::wait_for_files($pid_file, $log_file, $out);
$output = `grep Executed $log_file`;
like(
$output,

View File

@@ -48,7 +48,7 @@ SKIP: {
'Log file created'
);
sleep 3; # --run-time=2; if we sleep 2 we'll get intermittent failures.
wait_until(sub { return !-f '/tmp/pt-kill.pid' });
ok(
!-f '/tmp/pt-kill.pid',
'PID file removed'