Skip to content

Commit 36dc30a

Browse files
committed
pg_basebackup: Add tests for -R option
Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
1 parent 5d0e8bc commit 36dc30a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/bin/pg_basebackup/t/010_pg_basebackup.pl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use warnings;
33
use Cwd;
44
use TestLib;
5-
use Test::More tests => 35;
5+
use Test::More tests => 39;
66

77
program_help_ok('pg_basebackup');
88
program_version_ok('pg_basebackup');
@@ -138,3 +138,10 @@
138138
command_ok([ 'pg_basebackup', '-D', "$tempdir/tarbackup_l3", '-Ft' ],
139139
'pg_basebackup tar with long symlink target');
140140
psql 'postgres', "DROP TABLESPACE tblspc3;";
141+
142+
command_ok([ 'pg_basebackup', '-D', "$tempdir/backupR", '-R' ],
143+
'pg_basebackup -R runs');
144+
ok(-f "$tempdir/backupR/recovery.conf", 'recovery.conf was created');
145+
my $recovery_conf = slurp_file "$tempdir/backupR/recovery.conf";
146+
like($recovery_conf, qr/^standby_mode = 'on'$/m, 'recovery.conf sets standby_mode');
147+
like($recovery_conf, qr/^primary_conninfo = '.*port=$ENV{PGPORT}.*'$/m, 'recovery.conf sets primary_conninfo');

src/test/perl/TestLib.pm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ our @EXPORT = qw(
1111
start_test_server
1212
restart_test_server
1313
psql
14+
slurp_file
1415
system_or_bail
1516
system_log
1617
run_log
@@ -175,6 +176,13 @@ sub psql
175176
run [ 'psql', '-X', '-q', '-d', $dbname, '-f', '-' ], '<', \$sql or die;
176177
}
177178

179+
sub slurp_file
180+
{
181+
local $/;
182+
local @ARGV = @_;
183+
<>
184+
}
185+
178186
sub system_or_bail
179187
{
180188
if (system_log(@_) != 0)

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