Skip to content

Commit 3e353a7

Browse files
Add new TAP tests for pg_recvlogical
Craig Ringer, reviewed by Euler Taveira and Naoki Okano
1 parent 7c03078 commit 3e353a7

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/bin/pg_basebackup/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
PGFILEDESC = "pg_basebackup/pg_receivexlog/pg_recvlogical - streaming WAL and backup receivers"
1313
PGAPPICON=win32
1414

15+
EXTRA_INSTALL=contrib/test_decoding
16+
1517
subdir = src/bin/pg_basebackup
1618
top_builddir = ../../..
1719
include $(top_builddir)/src/Makefile.global
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
use strict;
2+
use warnings;
3+
use TestLib;
4+
use PostgresNode;
5+
use Test::More tests => 15;
6+
7+
program_help_ok('pg_recvlogical');
8+
program_version_ok('pg_recvlogical');
9+
program_options_handling_ok('pg_recvlogical');
10+
11+
my $node = get_new_node('main');
12+
13+
# Initialize node without replication settings
14+
$node->init(allows_streaming => 1, has_archiving => 1);
15+
$node->append_conf('postgresql.conf', q{
16+
wal_level = 'logical'
17+
max_replication_slots = 4
18+
max_wal_senders = 4
19+
log_min_messages = 'debug1'
20+
log_error_verbosity = verbose
21+
});
22+
$node->dump_info;
23+
$node->start;
24+
25+
$node->command_fails(['pg_recvlogical'],
26+
'pg_recvlogical needs a slot name');
27+
$node->command_fails(['pg_recvlogical', '-S', 'test'],
28+
'pg_recvlogical needs a database');
29+
$node->command_fails(['pg_recvlogical', '-S', 'test', '-d', 'postgres'],
30+
'pg_recvlogical needs an action');
31+
$node->command_fails(['pg_recvlogical', '-S', 'test', '-d', $node->connstr('postgres'), '--start'],
32+
'no destionation file');
33+
34+
$node->command_ok(['pg_recvlogical', '-S', 'test', '-d', $node->connstr('postgres'), '--create-slot'],
35+
'slot created');
36+
37+
my $slot = $node->slot('test');
38+
isnt($slot->{'restart_lsn'}, '', 'restart lsn is defined for new slot');
39+
40+
$node->psql('postgres', 'CREATE TABLE test_table(x integer)');
41+
$node->psql('postgres', 'INSERT INTO test_table(x) SELECT y FROM generate_series(1, 10) a(y);');
42+
my $nextlsn = $node->safe_psql('postgres', 'SELECT pg_current_xlog_insert_location()');
43+
chomp($nextlsn);
44+
45+
$node->command_ok(['pg_recvlogical', '-S', 'test', '-d', $node->connstr('postgres'), '--start', '--endpos', "$nextlsn", '--no-loop', '-f', '-'],
46+
'replayed a transaction');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy