Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5a20755

Browse files
kvapkelvich
authored andcommitted
Check that node 2 stops in tap-test 001. Make Cluster remove the node's pidfile when stopping one.
1 parent df87ce7 commit 5a20755

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

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;

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)