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

Commit 6c71467

Browse files
committed
mm relication test
1 parent 31208e7 commit 6c71467

File tree

1 file changed

+16
-29
lines changed

1 file changed

+16
-29
lines changed

t/001_basic_recovery.pl

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use warnings;
33
use PostgresNode;
44
use TestLib;
5-
use Test::More tests => 2;
5+
use Test::More tests => 3;
66
use DBI;
77
use DBD::Pg ':async';
88

@@ -54,6 +54,7 @@ sub PostgresNode::inet_connstr {
5454
for (my $i=0; $i < $nnodes; $i++) {
5555
$nodes[$i]->append_conf('postgresql.conf', $pgconf_common);
5656
$nodes[$i]->append_conf('postgresql.conf', qq(
57+
#port = ${ \$nodes[$i]->port }
5758
multimaster.node_id = @{[ $i + 1 ]}
5859
multimaster.conn_strings = '$mm_connstr'
5960
#multimaster.arbiter_port = ${ \$nodes[0]->port }
@@ -69,8 +70,8 @@ sub PostgresNode::inet_connstr {
6970
###############################################################################
7071

7172
my $psql_out;
72-
# XXX: change to poll_untill
73-
sleep(7);
73+
# XXX: create extension on start and poll_untill status is Online
74+
sleep(5);
7475

7576
###############################################################################
7677
# Replication check
@@ -79,11 +80,9 @@ sub PostgresNode::inet_connstr {
7980
$nodes[0]->psql('postgres', "
8081
create extension multimaster;
8182
create table if not exists t(k int primary key, v int);
82-
insert into t values(1, 10);
83-
");
84-
83+
insert into t values(1, 10);");
8584
$nodes[1]->psql('postgres', "select v from t where k=1;", stdout => \$psql_out);
86-
is($psql_out, '10', "Check sanity while all nodes are up.");
85+
is($psql_out, '10', "Check replication while all nodes are up.");
8786

8887
###############################################################################
8988
# Isolation regress checks
@@ -97,30 +96,18 @@ sub PostgresNode::inet_connstr {
9796

9897
$nodes[2]->teardown_node;
9998

100-
# $nodes[0]->poll_query_until('postgres',
101-
# "select disconnected = true from mtm.get_nodes_state() where id=3;")
102-
# or die "Timed out while waiting for node to disconnect";
103-
104-
$nodes[0]->psql('postgres', "
105-
insert into t values(2, 20);
106-
");
107-
99+
$nodes[0]->psql('postgres', "insert into t values(2, 20);");
108100
$nodes[1]->psql('postgres', "select v from t where k=2;", stdout => \$psql_out);
109-
is($psql_out, '20', "Check that we can commit after one node disconnect.");
110-
111-
112-
113-
114-
115-
116-
117-
118-
119-
120-
121-
122-
101+
is($psql_out, '20', "Check replication after node failure.");
123102

103+
###############################################################################
104+
# Work after node start
105+
###############################################################################
124106

107+
$nodes[2]->start;
108+
sleep(5); # XXX: here we can poll
109+
$nodes[0]->psql('postgres', "insert into t values(3, 30);");
110+
$nodes[2]->psql('postgres', "select v from t where k=3;", stdout => \$psql_out);
111+
is($psql_out, '30', "Check replication after failed node recovery.");
125112

126113

0 commit comments

Comments
 (0)