Skip to content

Commit 2ae80f1

Browse files
committed
Check that node 2 stops in tap-test 001. Make Cluster remove the node's pidfile when stopping one.
1 parent b8a2e5c commit 2ae80f1

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

contrib/mmts/Cluster.pm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ sub stopnode
142142

143143
my $pgdata = $node->data_dir;
144144
my $ret = TestLib::system_log('pg_ctl', '-D', $pgdata, '-m', 'fast', 'stop');
145+
my $pidfile = $node->data_dir . "/postmaster.pid";
146+
diag("unlink $pidfile");
147+
unlink $pidfile;
145148
$node->{_pid} = undef;
146149
$node->_update_pid;
147150

@@ -153,6 +156,12 @@ sub stopnode
153156
return 1;
154157
}
155158

159+
sub stopid
160+
{
161+
my ($self, $idx, $mode) = @_;
162+
return stopnode($self->{nodes}->[$idx]);
163+
}
164+
156165
sub killtree
157166
{
158167
my $root = shift;

contrib/mmts/t/001_basic_recovery.pl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use warnings;
33
use Cluster;
44
use TestLib;
5-
use Test::More tests => 8;
5+
use Test::More tests => 9;
66

77
my $cluster = new Cluster(3);
88
$cluster->init();
@@ -39,7 +39,15 @@
3939
###############################################################################
4040

4141
diag("stopping node 2");
42-
$cluster->{nodes}->[2]->teardown_node;
42+
if ($cluster->stopid(2, 'immediate')) {
43+
pass("node 2 stops");
44+
} else {
45+
fail("node 2 stops");
46+
if (!$cluster->stopid(2, 'kill')) {
47+
my $name = $cluster->{nodes}->[2]->name;
48+
BAIL_OUT("failed to kill $name");
49+
}
50+
}
4351

4452
sleep(5); # Wait until failure of node will be detected
4553

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy