mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 21:19:59 +00:00
Skip Daemon.t test that's not reliable, and wait until pid file is gone. Call wipe_clean() in pt-table-sync/bidirectional.t and pt-table-sync/issue_1065.t.
This commit is contained in:
@@ -24,8 +24,8 @@ my $d = new Daemon(o=>$o);
|
|||||||
my $pid_file = '/tmp/daemonizes.pl.pid';
|
my $pid_file = '/tmp/daemonizes.pl.pid';
|
||||||
my $log_file = '/tmp/daemonizes.output';
|
my $log_file = '/tmp/daemonizes.output';
|
||||||
sub rm_tmp_files() {
|
sub rm_tmp_files() {
|
||||||
1 while unlink $pid_file;
|
-e $pid_file && (unlink $pid_file || die "Error removing $pid_file");
|
||||||
1 while unlink $log_file;
|
-e $log_file && (unlink $log_file || die "Error removing $log_file");
|
||||||
}
|
}
|
||||||
|
|
||||||
# ############################################################################
|
# ############################################################################
|
||||||
@@ -124,8 +124,8 @@ SKIP: {
|
|||||||
'Reopens STDIN to /dev/null'
|
'Reopens STDIN to /dev/null'
|
||||||
);
|
);
|
||||||
|
|
||||||
TODO: {
|
SKIP: {
|
||||||
local $::TODO = "?";
|
skip "-t is not reliable", 1;
|
||||||
rm_tmp_files();
|
rm_tmp_files();
|
||||||
system("echo foo | $cmd 5 --daemonize --pid $pid_file --log $log_file");
|
system("echo foo | $cmd 5 --daemonize --pid $pid_file --log $log_file");
|
||||||
PerconaTest::wait_for_files($pid_file, $log_file);
|
PerconaTest::wait_for_files($pid_file, $log_file);
|
||||||
@@ -169,29 +169,35 @@ ok(
|
|||||||
my (undef, $tempfile) = tempfile();
|
my (undef, $tempfile) = tempfile();
|
||||||
|
|
||||||
system("$cmd 5 --daemonize --log $log_file --pid $pid_file 2>$tempfile");
|
system("$cmd 5 --daemonize --log $log_file --pid $pid_file 2>$tempfile");
|
||||||
PerconaTest::wait_for_files($log_file);
|
PerconaTest::wait_for_files($log_file, $pid_file);
|
||||||
|
|
||||||
$output = `ps wx | grep '$cmd 5' | grep -v grep`;
|
$output = `ps wx | grep '$cmd 5' | grep -v grep`;
|
||||||
chomp(my $new_pid = slurp_file($pid_file));
|
chomp(my $new_pid = slurp_file($pid_file));
|
||||||
sleep 1;
|
|
||||||
like(
|
like(
|
||||||
$output,
|
$output,
|
||||||
qr/$cmd/,
|
qr/$cmd/,
|
||||||
'Runs when PID file exists but old process is dead (issue 419)'
|
'Runs when PID file exists but old process is dead (issue 419)'
|
||||||
);
|
);
|
||||||
|
|
||||||
like(
|
like(
|
||||||
slurp_file($tempfile),
|
slurp_file($tempfile),
|
||||||
qr/$pid, is not running/,
|
qr/$pid, is not running/,
|
||||||
'Says that old PID is not running (issue 419)'
|
'Says that old PID is not running (issue 419)'
|
||||||
);
|
);
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
$pid != $new_pid,
|
$pid != $new_pid,
|
||||||
'Overwrites PID file with new PID (issue 419)'
|
'Overwrites PID file with new PID (issue 419)'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
PerconaTest::wait_until(sub { !-e $pid_file });
|
||||||
ok(
|
ok(
|
||||||
!-f $pid_file,
|
!-f $pid_file,
|
||||||
'Re-used PID file still removed (issue 419)'
|
'Re-used PID file still removed (issue 419)'
|
||||||
);
|
);
|
||||||
diag(`rm -rf /tmp/pre-daemonizes`);
|
|
||||||
|
diag(`rm $tempfile >/dev/null`);
|
||||||
|
|
||||||
# ############################################################################
|
# ############################################################################
|
||||||
# Check that it actually checks the running process.
|
# Check that it actually checks the running process.
|
||||||
|
@@ -534,7 +534,8 @@ SKIP: {
|
|||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
diag(`$trunk/sandbox/stop-sandbox 2900 >/dev/null`);
|
|
||||||
diag(`$trunk/sandbox/stop-sandbox 2901 >/dev/null`);
|
diag(`$trunk/sandbox/stop-sandbox 2901 >/dev/null`);
|
||||||
|
diag(`$trunk/sandbox/stop-sandbox 2900 >/dev/null`);
|
||||||
|
$sb->wipe_clean($c1_dbh);
|
||||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||||
exit;
|
exit;
|
||||||
|
@@ -58,5 +58,6 @@ like(
|
|||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
$sb->wipe_clean($master_dbh);
|
||||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||||
exit;
|
exit;
|
||||||
|
Reference in New Issue
Block a user