Skip to content

Commit 90c37c0

Browse files
committed
Test for old-style commit string and random order
1 parent f347f21 commit 90c37c0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/interfaces/libpq/t/001-multihost.pl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use warnings;
44
use PostgresNode;
55
use TestLib;
6-
use Test::More tests => 28;
6+
use Test::More tests => 29;
77

88
# Initialize master node
99

@@ -228,6 +228,7 @@ sub psql_conninfo
228228
{
229229
my ($connstr) = shift;
230230
my ($timed_out);
231+
diag("connect string: $connstr");
231232
my ($retcode, $stdout, $stderr) =
232233
psql($connstr, '\conninfo', timed_out => \$timed_out);
233234
if ($retcode == 0 && $stdout =~ /on host "([^"]*)" at port "([^"]*)"/s)
@@ -352,7 +353,7 @@ sub psql_server_addr
352353
# at least once
353354

354355
my %conncount = ();
355-
for (my $i = 0; $i < 9; $i++)
356+
for (my $i = 0; $i < 15; $i++)
356357
{
357358
my $conn = psql_conninfo(
358359
multiconnstring(
@@ -363,6 +364,17 @@ sub psql_server_addr
363364
}
364365
is(scalar(keys(%conncount)), 3, 'random order, readonly connect');
365366

367+
%conncount = ();
368+
for (my $i = 0; $i < 15; $i++)
369+
{
370+
my $conn = psql_conninfo(
371+
connstring2(
372+
[ $node_master, $node_standby_1, $node_standby_2 ],
373+
undef,
374+
{ target_server_type => 'any', hostorder => 'random' }));
375+
$conncount{$conn}++;
376+
}
377+
is(scalar(keys(%conncount)), 3, 'random order, readonly connect, old style connect string');
366378
# Test 7.2 - alternate (jdbc compatible) syntax for randomized hosts
367379

368380
for (my $i = 0; $i < 6; $i++)

0 commit comments

Comments
 (0)