aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2021-10-12 15:33:36 +0200
committerPeter Eisentraut <peter@eisentraut.org>2021-10-12 15:33:36 +0200
commit67c069848a998de1436cad2d67baedbf31c3a28c (patch)
treeafb829ba4f89db6b386042b0ddbb0bfc8385878a
parentc0280bc3edeb9e9958efc14083b6f301d2ef79d5 (diff)
downloadpostgresql-67c069848a998de1436cad2d67baedbf31c3a28c.tar.gz
postgresql-67c069848a998de1436cad2d67baedbf31c3a28c.zip
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
-rw-r--r--src/bin/psql/t/001_basic.pl13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/bin/psql/t/001_basic.pl b/src/bin/psql/t/001_basic.pl
index 38426a69d7a..c6d01c0abf0 100644
--- a/src/bin/psql/t/001_basic.pl
+++ b/src/bin/psql/t/001_basic.pl
@@ -6,7 +6,7 @@ use warnings;
use PostgresNode;
use TestLib;
-use Test::More tests => 23;
+use Test::More tests => 25;
program_help_ok('psql');
program_version_ok('psql');
@@ -26,8 +26,19 @@ foreach my $arg (qw(commands variables))
my $node = PostgresNode->new('main');
$node->init;
+$node->append_conf(
+ 'postgresql.conf', q{
+wal_level = 'logical'
+max_replication_slots = 4
+max_wal_senders = 4
+});
$node->start;
$node->command_like([ 'psql', '-c', '\copyright' ], qr/Copyright/, '\copyright');
$node->command_like([ 'psql', '-c', '\help' ], qr/ALTER/, '\help without arguments');
$node->command_like([ 'psql', '-c', '\help SELECT' ], qr/SELECT/, '\help');
+
+
+# Test clean handling of unsupported replication command responses
+$node->command_fails_like([ 'psql', 'replication=database', '-c', 'START_REPLICATION 0/0' ],
+ qr/^unexpected PQresultStatus: 8$/, 'handling of unexpected PQresultStatus');