aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2015-06-30 21:15:05 -0400
committerPeter Eisentraut <peter_e@gmx.net>2015-07-28 20:31:35 -0400
commit36dc30aa7e0ab9628a5a975a921b8ff82e8f31bf (patch)
tree277acd4535746e3f299fe1244610e3d38b8ad7cf /src
parent5d0e8bc9e036bffb88b7598aa4d46b7368a10f0c (diff)
downloadpostgresql-36dc30aa7e0ab9628a5a975a921b8ff82e8f31bf.tar.gz
postgresql-36dc30aa7e0ab9628a5a975a921b8ff82e8f31bf.zip
pg_basebackup: Add tests for -R option
Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_basebackup/t/010_pg_basebackup.pl9
-rw-r--r--src/test/perl/TestLib.pm8
2 files changed, 16 insertions, 1 deletions
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index e47c3a0bb7c..4eb4ed102de 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -2,7 +2,7 @@ use strict;
use warnings;
use Cwd;
use TestLib;
-use Test::More tests => 35;
+use Test::More tests => 39;
program_help_ok('pg_basebackup');
program_version_ok('pg_basebackup');
@@ -138,3 +138,10 @@ psql 'postgres',
command_ok([ 'pg_basebackup', '-D', "$tempdir/tarbackup_l3", '-Ft' ],
'pg_basebackup tar with long symlink target');
psql 'postgres', "DROP TABLESPACE tblspc3;";
+
+command_ok([ 'pg_basebackup', '-D', "$tempdir/backupR", '-R' ],
+ 'pg_basebackup -R runs');
+ok(-f "$tempdir/backupR/recovery.conf", 'recovery.conf was created');
+my $recovery_conf = slurp_file "$tempdir/backupR/recovery.conf";
+like($recovery_conf, qr/^standby_mode = 'on'$/m, 'recovery.conf sets standby_mode');
+like($recovery_conf, qr/^primary_conninfo = '.*port=$ENV{PGPORT}.*'$/m, 'recovery.conf sets primary_conninfo');
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index 5ef95f0246e..ca287456b40 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -11,6 +11,7 @@ our @EXPORT = qw(
start_test_server
restart_test_server
psql
+ slurp_file
system_or_bail
system_log
run_log
@@ -175,6 +176,13 @@ sub psql
run [ 'psql', '-X', '-q', '-d', $dbname, '-f', '-' ], '<', \$sql or die;
}
+sub slurp_file
+{
+ local $/;
+ local @ARGV = @_;
+ <>
+}
+
sub system_or_bail
{
if (system_log(@_) != 0)