mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +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 $log_file = '/tmp/daemonizes.output';
|
||||
sub rm_tmp_files() {
|
||||
1 while unlink $pid_file;
|
||||
1 while unlink $log_file;
|
||||
-e $pid_file && (unlink $pid_file || die "Error removing $pid_file");
|
||||
-e $log_file && (unlink $log_file || die "Error removing $log_file");
|
||||
}
|
||||
|
||||
# ############################################################################
|
||||
@@ -124,8 +124,8 @@ SKIP: {
|
||||
'Reopens STDIN to /dev/null'
|
||||
);
|
||||
|
||||
TODO: {
|
||||
local $::TODO = "?";
|
||||
SKIP: {
|
||||
skip "-t is not reliable", 1;
|
||||
rm_tmp_files();
|
||||
system("echo foo | $cmd 5 --daemonize --pid $pid_file --log $log_file");
|
||||
PerconaTest::wait_for_files($pid_file, $log_file);
|
||||
@@ -169,29 +169,35 @@ ok(
|
||||
my (undef, $tempfile) = 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`;
|
||||
chomp(my $new_pid = slurp_file($pid_file));
|
||||
sleep 1;
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/$cmd/,
|
||||
'Runs when PID file exists but old process is dead (issue 419)'
|
||||
);
|
||||
|
||||
like(
|
||||
slurp_file($tempfile),
|
||||
qr/$pid, is not running/,
|
||||
'Says that old PID is not running (issue 419)'
|
||||
);
|
||||
|
||||
ok(
|
||||
$pid != $new_pid,
|
||||
'Overwrites PID file with new PID (issue 419)'
|
||||
);
|
||||
|
||||
PerconaTest::wait_until(sub { !-e $pid_file });
|
||||
ok(
|
||||
!-f $pid_file,
|
||||
'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.
|
||||
|
@@ -534,7 +534,8 @@ SKIP: {
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
diag(`$trunk/sandbox/stop-sandbox 2900 >/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");
|
||||
exit;
|
||||
|
@@ -58,5 +58,6 @@ like(
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
$sb->wipe_clean($master_dbh);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
exit;
|
||||
|
Reference in New Issue
Block a user