-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reviewed-by: Pavel Stěhule <[email protected]> Reviewed-by: Erik Rijkers <[email protected]>
- Loading branch information
Showing
39 changed files
with
745 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
/localtime.c | ||
|
||
/initdb | ||
|
||
/tmp_check/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use strict; | ||
use warnings; | ||
use TestLib; | ||
use Test::More tests => 14; | ||
|
||
my $tempdir = TestLib::tempdir; | ||
|
||
program_help_ok('initdb'); | ||
program_version_ok('initdb'); | ||
program_options_handling_ok('initdb'); | ||
|
||
command_ok(['initdb', "$tempdir/data"], 'basic initdb'); | ||
command_fails(['initdb', "$tempdir/data"], 'existing data directory'); | ||
command_ok(['initdb', '-N', "$tempdir/data2"], 'nosync'); | ||
command_ok(['initdb', '-S', "$tempdir/data2"], 'sync only'); | ||
command_fails(['initdb', '-S', "$tempdir/data3"], 'sync missing data directory'); | ||
mkdir "$tempdir/data4" or BAIL_OUT($!); | ||
command_ok(['initdb', "$tempdir/data4"], 'existing empty data directory'); | ||
|
||
system_or_bail "rm -rf $tempdir/*"; | ||
|
||
command_ok(['initdb', "$tempdir/data", '-X', "$tempdir/pgxlog"], 'separate xlog directory'); | ||
|
||
system_or_bail "rm -rf $tempdir/*"; | ||
command_fails(['initdb', "$tempdir/data", '-X', 'pgxlog'], 'relative xlog directory not allowed'); | ||
|
||
system_or_bail "rm -rf $tempdir/*"; | ||
mkdir "$tempdir/pgxlog"; | ||
command_ok(['initdb', "$tempdir/data", '-X', "$tempdir/pgxlog"], 'existing empty xlog directory'); | ||
|
||
system_or_bail "rm -rf $tempdir/*"; | ||
mkdir "$tempdir/pgxlog"; | ||
mkdir "$tempdir/pgxlog/lost+found"; | ||
command_fails(['initdb', "$tempdir/data", '-X', "$tempdir/pgxlog"], 'existing nonempty xlog directory'); | ||
|
||
system_or_bail "rm -rf $tempdir/*"; | ||
command_ok(['initdb', "$tempdir/data", '-T', 'german'], 'select default dictionary'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/pg_basebackup | ||
/pg_receivexlog | ||
/pg_recvlogical | ||
|
||
/tmp_check/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
use strict; | ||
use warnings; | ||
use Cwd; | ||
use TestLib; | ||
use Test::More tests => 28; | ||
|
||
program_help_ok('pg_basebackup'); | ||
program_version_ok('pg_basebackup'); | ||
program_options_handling_ok('pg_basebackup'); | ||
|
||
my $tempdir = tempdir; | ||
start_test_server $tempdir; | ||
|
||
command_fails(['pg_basebackup'], 'pg_basebackup needs target directory specified'); | ||
command_fails(['pg_basebackup', '-D', "$tempdir/backup"], 'pg_basebackup fails because of hba'); | ||
|
||
open HBA, ">>$tempdir/pgdata/pg_hba.conf"; | ||
print HBA "local replication all trust\n"; | ||
print HBA "host replication all 127.0.0.1/32 trust\n"; | ||
print HBA "host replication all ::1/128 trust\n"; | ||
close HBA; | ||
system_or_bail 'pg_ctl', '-s', '-D', "$tempdir/pgdata", 'reload'; | ||
|
||
command_fails(['pg_basebackup', '-D', "$tempdir/backup"], 'pg_basebackup fails because of WAL configuration'); | ||
|
||
open CONF, ">>$tempdir/pgdata/postgresql.conf"; | ||
print CONF "max_wal_senders = 10\n"; | ||
print CONF "wal_level = archive\n"; | ||
close CONF; | ||
restart_test_server; | ||
|
||
command_ok(['pg_basebackup', '-D', "$tempdir/backup"], 'pg_basebackup runs'); | ||
ok(-f "$tempdir/backup/PG_VERSION", 'backup was created'); | ||
|
||
command_ok(['pg_basebackup', '-D', "$tempdir/backup2", '--xlogdir', "$tempdir/xlog2"], 'separate xlog directory'); | ||
ok(-f "$tempdir/backup2/PG_VERSION", 'backup was created'); | ||
ok(-d "$tempdir/xlog2/", 'xlog directory was created'); | ||
|
||
command_ok(['pg_basebackup', '-D', "$tempdir/tarbackup", '-Ft'], 'tar format'); | ||
ok(-f "$tempdir/tarbackup/base.tar", 'backup tar was created'); | ||
|
||
mkdir "$tempdir/tblspc1"; | ||
psql 'postgres', "CREATE TABLESPACE tblspc1 LOCATION '$tempdir/tblspc1';"; | ||
psql 'postgres', "CREATE TABLE test1 (a int) TABLESPACE tblspc1;"; | ||
command_ok(['pg_basebackup', '-D', "$tempdir/tarbackup2", '-Ft'], 'tar format with tablespaces'); | ||
ok(-f "$tempdir/tarbackup2/base.tar", 'backup tar was created'); | ||
my @tblspc_tars = glob "$tempdir/tarbackup2/[0-9]*.tar"; | ||
is(scalar(@tblspc_tars), 1, 'one tablespace tar was created'); | ||
|
||
command_fails(['pg_basebackup', '-D', "$tempdir/backup1", '-Fp'], | ||
'plain format with tablespaces fails without tablespace mapping'); | ||
|
||
command_ok(['pg_basebackup', '-D', "$tempdir/backup1", '-Fp', | ||
"-T$tempdir/tblspc1=$tempdir/tbackup/tblspc1"], | ||
'plain format with tablespaces succeeds with tablespace mapping'); | ||
ok(-d "$tempdir/tbackup/tblspc1", 'tablespace was relocated'); | ||
opendir(my $dh, "$tempdir/pgdata/pg_tblspc") or die; | ||
ok((grep { -l "$tempdir/backup1/pg_tblspc/$_" and readlink "$tempdir/backup1/pg_tblspc/$_" eq "$tempdir/tbackup/tblspc1" } readdir($dh)), | ||
"tablespace symlink was updated"); | ||
closedir $dh; | ||
|
||
mkdir "$tempdir/tbl=spc2"; | ||
psql 'postgres', "DROP TABLE test1;"; | ||
psql 'postgres', "DROP TABLESPACE tblspc1;"; | ||
psql 'postgres', "CREATE TABLESPACE tblspc2 LOCATION '$tempdir/tbl=spc2';"; | ||
command_ok(['pg_basebackup', '-D', "$tempdir/backup3", '-Fp', | ||
"-T$tempdir/tbl\\=spc2=$tempdir/tbackup/tbl\\=spc2"], | ||
'mapping tablespace with = sign in path'); | ||
ok(-d "$tempdir/tbackup/tbl=spc2", 'tablespace with = sign was relocated'); | ||
|
||
psql 'postgres', "DROP TABLESPACE tblspc2;"; | ||
|
||
command_fails(['pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', | ||
"-T=/foo"], | ||
'-T with empty old directory fails'); | ||
command_fails(['pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', | ||
"-T/foo="], | ||
'-T with empty new directory fails'); | ||
command_fails(['pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', | ||
"-T/foo=/bar=/baz"], | ||
'-T with multiple = fails'); | ||
command_fails(['pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', | ||
"-Tfoo=/bar"], | ||
'-T with old directory not absolute fails'); | ||
command_fails(['pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', | ||
"-T/foo=bar"], | ||
'-T with new directory not absolute fails'); | ||
command_fails(['pg_basebackup', '-D', "$tempdir/backup_foo", '-Fp', | ||
"-Tfoo"], | ||
'-T with invalid format fails'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use strict; | ||
use warnings; | ||
use TestLib; | ||
use Test::More tests => 3; | ||
|
||
program_help_ok('pg_receivexlog'); | ||
program_version_ok('pg_receivexlog'); | ||
program_options_handling_ok('pg_receivexlog'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/pg_config | ||
/tmp_check/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use strict; | ||
use warnings; | ||
use TestLib; | ||
use Test::More tests => 7; | ||
|
||
program_help_ok('pg_config'); | ||
program_version_ok('pg_config'); | ||
program_options_handling_ok('pg_config'); | ||
command_like(['pg_config', '--bindir'], qr/bin/, 'pg_config single option'); # XXX might be wrong | ||
command_like(['pg_config', '--bindir', '--libdir'], qr/bin.*\n.*lib/, 'pg_config two options'); | ||
command_like(['pg_config', '--libdir', '--bindir'], qr/lib.*\n.*bin/, 'pg_config two options different order'); | ||
command_like(['pg_config'], qr/.*\n.*\n.*/, 'pg_config without options prints many lines'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/pg_controldata | ||
/tmp_check/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use strict; | ||
use warnings; | ||
use TestLib; | ||
use Test::More tests => 6; | ||
|
||
my $tempdir = TestLib::tempdir; | ||
|
||
program_help_ok('pg_controldata'); | ||
program_version_ok('pg_controldata'); | ||
program_options_handling_ok('pg_controldata'); | ||
command_fails(['pg_controldata'], 'pg_controldata without arguments fails'); | ||
command_fails(['pg_controldata', 'nonexistent'], 'pg_controldata with nonexistent directory fails'); | ||
system_or_bail "initdb -D $tempdir/data -A trust >/dev/null"; | ||
command_like(['pg_controldata', "$tempdir/data"], qr/checkpoint/, 'pg_controldata produces output'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/pg_ctl | ||
/tmp_check/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.