Skip to content

Commit 67c0698

Browse files
committed
psql: Add test for handling of replication commands
Add a test for the clean handling of unsupported replication command responses. This was once accidentally broken, and it seems unusual enough that it's easy to forget when testing manually. Discussion: https://www.postgresql.org/message-id/2570e2ae-fa0f-aac9-f72f-bb59a9983a20@enterprisedb.com
1 parent c0280bc commit 67c0698

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/bin/psql/t/001_basic.pl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use PostgresNode;
88
use TestLib;
9-
use Test::More tests => 23;
9+
use Test::More tests => 25;
1010

1111
program_help_ok('psql');
1212
program_version_ok('psql');
@@ -26,8 +26,19 @@
2626

2727
my $node = PostgresNode->new('main');
2828
$node->init;
29+
$node->append_conf(
30+
'postgresql.conf', q{
31+
wal_level = 'logical'
32+
max_replication_slots = 4
33+
max_wal_senders = 4
34+
});
2935
$node->start;
3036

3137
$node->command_like([ 'psql', '-c', '\copyright' ], qr/Copyright/, '\copyright');
3238
$node->command_like([ 'psql', '-c', '\help' ], qr/ALTER/, '\help without arguments');
3339
$node->command_like([ 'psql', '-c', '\help SELECT' ], qr/SELECT/, '\help');
40+
41+
42+
# Test clean handling of unsupported replication command responses
43+
$node->command_fails_like([ 'psql', 'replication=database', '-c', 'START_REPLICATION 0/0' ],
44+
qr/^unexpected PQresultStatus: 8$/, 'handling of unexpected PQresultStatus');

0 commit comments

Comments
 (0)