Move Perl test modules to a better namespace
The five modules in our TAP test framework all had names in the top level namespace. This is unwise because, even though we're not exporting them to CPAN, the names can leak, for example if they are exported by the RPM build process. We therefore move the modules to the PostgreSQL::Test namespace. In the process PostgresNode is renamed to Cluster, and TestLib is renamed to Utils. PostgresVersion becomes simply PostgreSQL::Version, to avoid possible confusion about what it's the version of. Discussion: https://postgr.es/m/aede93a4-7d92-ef26-398f-5094944c2504@dunslane.net Reviewed by Erik Rijkers and Michael Paquier
This commit is contained in:
parent
3cd9c3b921
commit
b3b4d8e68a
@ -4,8 +4,8 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
|
||||
use Fcntl qw(:seek);
|
||||
use Test::More tests => 272;
|
||||
@ -15,7 +15,7 @@ my ($node, $result);
|
||||
#
|
||||
# Test set-up
|
||||
#
|
||||
$node = PostgresNode->new('test');
|
||||
$node = PostgreSQL::Test::Cluster->new('test');
|
||||
$node->init;
|
||||
$node->append_conf('postgresql.conf', 'autovacuum=off');
|
||||
$node->start;
|
||||
|
@ -6,8 +6,8 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Config;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
|
||||
use Test::More tests => 4;
|
||||
|
||||
@ -16,7 +16,7 @@ my ($node, $result);
|
||||
#
|
||||
# Test set-up
|
||||
#
|
||||
$node = PostgresNode->new('CIC_test');
|
||||
$node = PostgreSQL::Test::Cluster->new('CIC_test');
|
||||
$node->init;
|
||||
$node->append_conf('postgresql.conf', 'lock_timeout = 180000');
|
||||
$node->start;
|
||||
|
@ -6,8 +6,8 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Config;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
|
||||
use Test::More tests => 6;
|
||||
|
||||
@ -16,7 +16,7 @@ my ($node, $result);
|
||||
#
|
||||
# Test set-up
|
||||
#
|
||||
$node = PostgresNode->new('CIC_2PC_test');
|
||||
$node = PostgreSQL::Test::Cluster->new('CIC_2PC_test');
|
||||
$node->init;
|
||||
$node->append_conf('postgresql.conf', 'max_prepared_transactions = 10');
|
||||
$node->append_conf('postgresql.conf', 'lock_timeout = 180000');
|
||||
|
@ -4,11 +4,11 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 4;
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->append_conf('postgresql.conf',
|
||||
"shared_preload_libraries = 'auto_explain'");
|
||||
|
@ -4,8 +4,8 @@
|
||||
# Test generic xlog record work for bloom index replication.
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 31;
|
||||
|
||||
my $node_primary;
|
||||
@ -41,7 +41,7 @@ SELECT * FROM tst WHERE i = 7 AND t = 'e';
|
||||
}
|
||||
|
||||
# Initialize primary node
|
||||
$node_primary = PostgresNode->new('primary');
|
||||
$node_primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node_primary->init(allows_streaming => 1);
|
||||
$node_primary->start;
|
||||
my $backup_name = 'my_backup';
|
||||
@ -50,7 +50,7 @@ my $backup_name = 'my_backup';
|
||||
$node_primary->backup($backup_name);
|
||||
|
||||
# Create streaming standby linking to primary
|
||||
$node_standby = PostgresNode->new('standby');
|
||||
$node_standby = PostgreSQL::Test::Cluster->new('standby');
|
||||
$node_standby->init_from_backup($node_primary, $backup_name,
|
||||
has_streaming => 1);
|
||||
$node_standby->start;
|
||||
|
@ -4,7 +4,7 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 8;
|
||||
|
||||
#########################################
|
||||
|
@ -6,12 +6,12 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use File::Path qw(rmtree);
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 2;
|
||||
|
||||
# Test set-up
|
||||
my $node = PostgresNode->new('test');
|
||||
my $node = PostgreSQL::Test::Cluster->new('test');
|
||||
$node->init(allows_streaming => 'logical');
|
||||
$node->append_conf('postgresql.conf', 'synchronous_commit = on');
|
||||
$node->start;
|
||||
|
@ -4,7 +4,7 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 8;
|
||||
|
||||
program_help_ok('vacuumlo');
|
||||
|
@ -9,11 +9,11 @@ use strict;
|
||||
use warnings;
|
||||
use Fcntl ':mode';
|
||||
use File::stat qw{lstat};
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 22;
|
||||
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||
my $xlogdir = "$tempdir/pgxlog";
|
||||
my $datadir = "$tempdir/data";
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 8;
|
||||
|
||||
program_help_ok('pg_amcheck');
|
||||
|
@ -4,13 +4,13 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 76;
|
||||
|
||||
# Test set-up
|
||||
my ($node, $port);
|
||||
$node = PostgresNode->new('test');
|
||||
$node = PostgreSQL::Test::Cluster->new('test');
|
||||
$node->init;
|
||||
$node->start;
|
||||
$port = $node->port;
|
||||
|
@ -4,8 +4,8 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
|
||||
use Fcntl qw(:seek);
|
||||
use Test::More tests => 63;
|
||||
@ -120,7 +120,7 @@ sub perform_all_corruptions()
|
||||
}
|
||||
|
||||
# Test set-up
|
||||
$node = PostgresNode->new('test');
|
||||
$node = PostgreSQL::Test::Cluster->new('test');
|
||||
$node->init;
|
||||
$node->append_conf('postgresql.conf', 'autovacuum=off');
|
||||
$node->start;
|
||||
@ -316,7 +316,7 @@ plan_to_remove_relation_file('db2', 's1.t1_btree');
|
||||
# Leave 'db3' uncorrupted
|
||||
#
|
||||
|
||||
# Standard first arguments to TestLib functions
|
||||
# Standard first arguments to PostgreSQL::Test::Utils functions
|
||||
my @cmd = ('pg_amcheck', '-p', $port);
|
||||
|
||||
# Regular expressions to match various expected output
|
||||
|
@ -4,8 +4,8 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
|
||||
use Fcntl qw(:seek);
|
||||
use Test::More;
|
||||
@ -178,7 +178,7 @@ umask(0077);
|
||||
# Set up the node. Once we create and corrupt the table,
|
||||
# autovacuum workers visiting the table could crash the backend.
|
||||
# Disable autovacuum so that won't happen.
|
||||
my $node = PostgresNode->new('test');
|
||||
my $node = PostgreSQL::Test::Cluster->new('test');
|
||||
$node->init;
|
||||
$node->append_conf('postgresql.conf', 'autovacuum=off');
|
||||
|
||||
|
@ -6,11 +6,11 @@
|
||||
#
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 5;
|
||||
|
||||
my $node = PostgresNode->new('test');
|
||||
my $node = PostgreSQL::Test::Cluster->new('test');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
|
@ -3,14 +3,14 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 42;
|
||||
|
||||
program_help_ok('pg_archivecleanup');
|
||||
program_version_ok('pg_archivecleanup');
|
||||
program_options_handling_ok('pg_archivecleanup');
|
||||
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||
|
||||
my @walfiles = (
|
||||
'00000001000000370000000C.gz', '00000001000000370000000D',
|
||||
|
@ -8,17 +8,17 @@ use Config;
|
||||
use File::Basename qw(basename dirname);
|
||||
use File::Path qw(rmtree);
|
||||
use Fcntl qw(:seek);
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 110;
|
||||
|
||||
program_help_ok('pg_basebackup');
|
||||
program_version_ok('pg_basebackup');
|
||||
program_options_handling_ok('pg_basebackup');
|
||||
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
|
||||
# Set umask so test directories and files are created with default permissions
|
||||
umask(0077);
|
||||
@ -238,14 +238,14 @@ $node->start;
|
||||
# to our physical temp location. That way we can use shorter names
|
||||
# for the tablespace directories, which hopefully won't run afoul of
|
||||
# the 99 character length limit.
|
||||
my $sys_tempdir = TestLib::tempdir_short;
|
||||
my $real_sys_tempdir = TestLib::perl2host($sys_tempdir) . "/tempdir";
|
||||
my $sys_tempdir = PostgreSQL::Test::Utils::tempdir_short;
|
||||
my $real_sys_tempdir = PostgreSQL::Test::Utils::perl2host($sys_tempdir) . "/tempdir";
|
||||
my $shorter_tempdir = $sys_tempdir . "/tempdir";
|
||||
dir_symlink "$tempdir", $shorter_tempdir;
|
||||
|
||||
mkdir "$tempdir/tblspc1";
|
||||
my $realTsDir = "$real_sys_tempdir/tblspc1";
|
||||
my $real_tempdir = TestLib::perl2host($tempdir);
|
||||
my $real_tempdir = PostgreSQL::Test::Utils::perl2host($tempdir);
|
||||
$node->safe_psql('postgres',
|
||||
"CREATE TABLESPACE tblspc1 LOCATION '$realTsDir';");
|
||||
$node->safe_psql('postgres',
|
||||
@ -270,7 +270,7 @@ SKIP:
|
||||
skip "no tar program available", 1
|
||||
if (!defined $tar || $tar eq '');
|
||||
|
||||
my $node2 = PostgresNode->new('replica');
|
||||
my $node2 = PostgreSQL::Test::Cluster->new('replica');
|
||||
|
||||
# Recover main data directory
|
||||
$node2->init_from_backup($node, 'tarbackup2', tar_program => $tar);
|
||||
@ -279,7 +279,7 @@ SKIP:
|
||||
my $repTsDir = "$tempdir/tblspc1replica";
|
||||
my $realRepTsDir = "$real_sys_tempdir/tblspc1replica";
|
||||
mkdir $repTsDir;
|
||||
TestLib::system_or_bail($tar, 'xf', $tblspc_tars[0], '-C', $repTsDir);
|
||||
PostgreSQL::Test::Utils::system_or_bail($tar, 'xf', $tblspc_tars[0], '-C', $repTsDir);
|
||||
|
||||
# Update tablespace map to point to new directory.
|
||||
# XXX Ideally pg_basebackup would handle this.
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgresNode;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use Test::More tests => 27;
|
||||
|
||||
program_help_ok('pg_receivewal');
|
||||
@ -14,7 +14,7 @@ program_options_handling_ok('pg_receivewal');
|
||||
# Set umask so test directories and files are created with default permissions
|
||||
umask(0077);
|
||||
|
||||
my $primary = PostgresNode->new('primary');
|
||||
my $primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$primary->init(allows_streaming => 1);
|
||||
$primary->start;
|
||||
|
||||
|
@ -3,15 +3,15 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgresNode;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use Test::More tests => 20;
|
||||
|
||||
program_help_ok('pg_recvlogical');
|
||||
program_version_ok('pg_recvlogical');
|
||||
program_options_handling_ok('pg_recvlogical');
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
|
||||
# Initialize node without replication settings
|
||||
$node->init(allows_streaming => 1, has_archiving => 1);
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 8;
|
||||
|
||||
program_help_ok('pg_checksums');
|
||||
|
@ -7,8 +7,8 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Config;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
|
||||
use Fcntl qw(:seek);
|
||||
use Test::More tests => 66;
|
||||
@ -93,7 +93,7 @@ sub check_relation_corruption
|
||||
}
|
||||
|
||||
# Initialize node with checksums disabled.
|
||||
my $node = PostgresNode->new('node_checksum');
|
||||
my $node = PostgreSQL::Test::Cluster->new('node_checksum');
|
||||
$node->init();
|
||||
my $pgdata = $node->data_dir;
|
||||
|
||||
@ -207,7 +207,7 @@ check_relation_corruption($node, 'corrupt1', 'pg_default');
|
||||
my $basedir = $node->basedir;
|
||||
my $tablespace_dir = "$basedir/ts_corrupt_dir";
|
||||
mkdir($tablespace_dir);
|
||||
$tablespace_dir = TestLib::perl2host($tablespace_dir);
|
||||
$tablespace_dir = PostgreSQL::Test::Utils::perl2host($tablespace_dir);
|
||||
$node->safe_psql('postgres',
|
||||
"CREATE TABLESPACE ts_corrupt LOCATION '$tablespace_dir';");
|
||||
check_relation_corruption($node, 'corrupt2', 'ts_corrupt');
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 20;
|
||||
|
||||
program_help_ok('pg_config');
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 17;
|
||||
|
||||
program_help_ok('pg_controldata');
|
||||
@ -14,7 +14,7 @@ command_fails(['pg_controldata'], 'pg_controldata without arguments fails');
|
||||
command_fails([ 'pg_controldata', 'nonexistent' ],
|
||||
'pg_controldata with nonexistent directory fails');
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
|
||||
command_like([ 'pg_controldata', $node->data_dir ],
|
||||
|
@ -7,12 +7,12 @@ use warnings;
|
||||
use Config;
|
||||
use Fcntl ':mode';
|
||||
use File::stat qw{lstat};
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 24;
|
||||
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $tempdir_short = TestLib::tempdir_short;
|
||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||
my $tempdir_short = PostgreSQL::Test::Utils::tempdir_short;
|
||||
|
||||
program_help_ok('pg_ctl');
|
||||
program_version_ok('pg_ctl');
|
||||
@ -25,11 +25,11 @@ command_ok([ 'pg_ctl', 'initdb', '-D', "$tempdir/data", '-o', '-N' ],
|
||||
'pg_ctl initdb');
|
||||
command_ok([ $ENV{PG_REGRESS}, '--config-auth', "$tempdir/data" ],
|
||||
'configure authentication');
|
||||
my $node_port = PostgresNode::get_free_port();
|
||||
my $node_port = PostgreSQL::Test::Cluster::get_free_port();
|
||||
open my $conf, '>>', "$tempdir/data/postgresql.conf";
|
||||
print $conf "fsync = off\n";
|
||||
print $conf "port = $node_port\n";
|
||||
print $conf TestLib::slurp_file($ENV{TEMP_CONFIG})
|
||||
print $conf PostgreSQL::Test::Utils::slurp_file($ENV{TEMP_CONFIG})
|
||||
if defined $ENV{TEMP_CONFIG};
|
||||
|
||||
if ($use_unix_sockets)
|
||||
@ -44,7 +44,7 @@ else
|
||||
close $conf;
|
||||
my $ctlcmd = [
|
||||
'pg_ctl', 'start', '-D', "$tempdir/data", '-l',
|
||||
"$TestLib::log_path/001_start_stop_server.log"
|
||||
"$PostgreSQL::Test::Utils::log_path/001_start_stop_server.log"
|
||||
];
|
||||
if ($Config{osname} ne 'msys')
|
||||
{
|
||||
|
@ -4,16 +4,16 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 3;
|
||||
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||
|
||||
command_exit_is([ 'pg_ctl', 'status', '-D', "$tempdir/nonexistent" ],
|
||||
4, 'pg_ctl status with nonexistent directory');
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
|
||||
command_exit_is([ 'pg_ctl', 'status', '-D', $node->data_dir ],
|
||||
|
@ -4,18 +4,18 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 12;
|
||||
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||
|
||||
command_fails_like(
|
||||
[ 'pg_ctl', '-D', "$tempdir/nonexistent", 'promote' ],
|
||||
qr/directory .* does not exist/,
|
||||
'pg_ctl promote with nonexistent directory');
|
||||
|
||||
my $node_primary = PostgresNode->new('primary');
|
||||
my $node_primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node_primary->init(allows_streaming => 1);
|
||||
|
||||
command_fails_like(
|
||||
@ -30,7 +30,7 @@ command_fails_like(
|
||||
qr/not in standby mode/,
|
||||
'pg_ctl promote of primary instance fails');
|
||||
|
||||
my $node_standby = PostgresNode->new('standby');
|
||||
my $node_standby = PostgreSQL::Test::Cluster->new('standby');
|
||||
$node_primary->backup('my_backup');
|
||||
$node_standby->init_from_backup($node_primary, 'my_backup',
|
||||
has_streaming => 1);
|
||||
@ -47,7 +47,7 @@ ok( $node_standby->poll_query_until(
|
||||
'promoted standby is not in recovery');
|
||||
|
||||
# same again with default wait option
|
||||
$node_standby = PostgresNode->new('standby2');
|
||||
$node_standby = PostgreSQL::Test::Cluster->new('standby2');
|
||||
$node_standby->init_from_backup($node_primary, 'my_backup',
|
||||
has_streaming => 1);
|
||||
$node_standby->start;
|
||||
|
@ -4,8 +4,8 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 10;
|
||||
use Time::HiRes qw(usleep);
|
||||
|
||||
@ -60,7 +60,7 @@ sub check_log_pattern
|
||||
}
|
||||
|
||||
# Set up node with logging collector
|
||||
my $node = PostgresNode->new('primary');
|
||||
my $node = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node->init();
|
||||
$node->append_conf(
|
||||
'postgresql.conf', qq(
|
||||
|
@ -5,11 +5,11 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Config;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 82;
|
||||
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||
|
||||
#########################################
|
||||
# Basic checks
|
||||
|
@ -5,11 +5,11 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Config;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More;
|
||||
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||
|
||||
###############################################################
|
||||
# Definition of the pg_dump runs to make.
|
||||
@ -25,7 +25,7 @@ my $tempdir = TestLib::tempdir;
|
||||
# the full command and arguments to run. Note that this is run
|
||||
# using $node->command_ok(), so the port does not need to be
|
||||
# specified and is pulled from $PGPORT, which is set by the
|
||||
# PostgresNode system.
|
||||
# PostgreSQL::Test::Cluster system.
|
||||
#
|
||||
# restore_cmd is the pg_restore command to run, if any. Note
|
||||
# that this should generally be used when the pg_dump goes to
|
||||
@ -3577,7 +3577,7 @@ my %tests = (
|
||||
#########################################
|
||||
# Create a PG instance to test actually dumping from
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 3;
|
||||
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
my $port = $node->port;
|
||||
|
||||
$node->init;
|
||||
|
@ -4,11 +4,11 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More;
|
||||
|
||||
if ($TestLib::is_msys2)
|
||||
if ($PostgreSQL::Test::Utils::is_msys2)
|
||||
{
|
||||
plan skip_all => 'High bit name tests fail on Msys2';
|
||||
}
|
||||
@ -34,7 +34,7 @@ my $dbname1 =
|
||||
. generate_ascii_string(1, 9)
|
||||
. generate_ascii_string(11, 12)
|
||||
. generate_ascii_string(14, 33)
|
||||
. ($TestLib::windows_os ? '' : '"x"') # IPC::Run mishandles '"' on Windows
|
||||
. ($PostgreSQL::Test::Utils::windows_os ? '' : '"x"') # IPC::Run mishandles '"' on Windows
|
||||
. generate_ascii_string(35, 43) # skip ','
|
||||
. generate_ascii_string(45, 54);
|
||||
my $dbname2 = 'regression' . generate_ascii_string(55, 65) # skip 'B'-'W'
|
||||
@ -51,7 +51,7 @@ my $dbname4 = 'regression' . generate_ascii_string(203, 255);
|
||||
my $src_bootstrap_super = 'regress_postgres';
|
||||
my $dst_bootstrap_super = 'boot';
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init(extra =>
|
||||
[ '-U', $src_bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
|
||||
|
||||
@ -175,13 +175,13 @@ system_log('cat', $plain);
|
||||
my ($stderr, $result);
|
||||
my $restore_super = qq{regress_a'b\\c=d\\ne"f};
|
||||
$restore_super =~ s/"//g
|
||||
if $TestLib::windows_os; # IPC::Run mishandles '"' on Windows
|
||||
if $PostgreSQL::Test::Utils::windows_os; # IPC::Run mishandles '"' on Windows
|
||||
|
||||
|
||||
# Restore full dump through psql using environment variables for
|
||||
# dbname/user connection parameters
|
||||
|
||||
my $envar_node = PostgresNode->new('destination_envar');
|
||||
my $envar_node = PostgreSQL::Test::Cluster->new('destination_envar');
|
||||
$envar_node->init(
|
||||
extra =>
|
||||
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ],
|
||||
@ -208,7 +208,7 @@ is($stderr, '', 'no dump errors');
|
||||
# dbname/user connection parameters. "\connect dbname=" forgets
|
||||
# user/port from command line.
|
||||
|
||||
my $cmdline_node = PostgresNode->new('destination_cmdline');
|
||||
my $cmdline_node = PostgreSQL::Test::Cluster->new('destination_cmdline');
|
||||
$cmdline_node->init(
|
||||
extra =>
|
||||
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ],
|
||||
|
@ -4,15 +4,15 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 12;
|
||||
|
||||
program_help_ok('pg_resetwal');
|
||||
program_version_ok('pg_resetwal');
|
||||
program_options_handling_ok('pg_resetwal');
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
|
||||
command_like([ 'pg_resetwal', '-n', $node->data_dir ],
|
||||
|
@ -6,11 +6,11 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 6;
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
|
||||
my $pg_control = $node->data_dir . '/global/pg_control';
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 23;
|
||||
|
||||
use FindBin;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 7;
|
||||
|
||||
use FindBin;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 5;
|
||||
|
||||
use File::Find;
|
||||
|
@ -8,7 +8,7 @@ use strict;
|
||||
use warnings;
|
||||
use File::Copy;
|
||||
use File::Path qw(rmtree);
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 5;
|
||||
|
||||
use FindBin;
|
||||
@ -20,7 +20,7 @@ sub run_test
|
||||
{
|
||||
my $test_mode = shift;
|
||||
|
||||
my $primary_xlogdir = "${TestLib::tmp_check}/xlog_primary";
|
||||
my $primary_xlogdir = "${PostgreSQL::Test::Utils::tmp_check}/xlog_primary";
|
||||
|
||||
rmtree($primary_xlogdir);
|
||||
RewindTest::setup_cluster($test_mode);
|
||||
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 1;
|
||||
|
||||
use FindBin;
|
||||
|
@ -6,15 +6,15 @@
|
||||
#
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 12;
|
||||
|
||||
program_help_ok('pg_rewind');
|
||||
program_version_ok('pg_rewind');
|
||||
program_options_handling_ok('pg_rewind');
|
||||
|
||||
my $primary_pgdata = TestLib::tempdir;
|
||||
my $standby_pgdata = TestLib::tempdir;
|
||||
my $primary_pgdata = PostgreSQL::Test::Utils::tempdir;
|
||||
my $standby_pgdata = PostgreSQL::Test::Utils::tempdir;
|
||||
command_fails(
|
||||
[
|
||||
'pg_rewind', '--debug',
|
||||
|
@ -26,16 +26,16 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 3;
|
||||
|
||||
use FindBin;
|
||||
use lib $FindBin::RealBin;
|
||||
use File::Copy;
|
||||
use PostgresNode;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use RewindTest;
|
||||
|
||||
my $tmp_folder = TestLib::tempdir;
|
||||
my $tmp_folder = PostgreSQL::Test::Utils::tempdir;
|
||||
|
||||
my $node_a;
|
||||
my $node_b;
|
||||
@ -58,13 +58,13 @@ primary_psql("CHECKPOINT");
|
||||
#
|
||||
# A (primary) <--- B (standby) <--- C (standby)
|
||||
$node_a->backup('my_backup');
|
||||
$node_b = PostgresNode->new('node_b');
|
||||
$node_b = PostgreSQL::Test::Cluster->new('node_b');
|
||||
$node_b->init_from_backup($node_a, 'my_backup', has_streaming => 1);
|
||||
$node_b->set_standby_mode();
|
||||
$node_b->start;
|
||||
|
||||
$node_b->backup('my_backup');
|
||||
$node_c = PostgresNode->new('node_c');
|
||||
$node_c = PostgreSQL::Test::Cluster->new('node_c');
|
||||
$node_c->init_from_backup($node_b, 'my_backup', has_streaming => 1);
|
||||
$node_c->set_standby_mode();
|
||||
$node_c->start;
|
||||
|
@ -32,15 +32,15 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 3;
|
||||
|
||||
use File::Copy;
|
||||
|
||||
my $tmp_folder = TestLib::tempdir;
|
||||
my $tmp_folder = PostgreSQL::Test::Utils::tempdir;
|
||||
|
||||
my $node_1 = PostgresNode->new('node_1');
|
||||
my $node_1 = PostgreSQL::Test::Cluster->new('node_1');
|
||||
$node_1->init(allows_streaming => 1);
|
||||
$node_1->append_conf(
|
||||
'postgresql.conf', qq(
|
||||
@ -60,11 +60,11 @@ $node_1->safe_psql('postgres', "INSERT INTO public.bar VALUES ('in both')");
|
||||
my $backup_name = 'my_backup';
|
||||
$node_1->backup($backup_name);
|
||||
|
||||
my $node_2 = PostgresNode->new('node_2');
|
||||
my $node_2 = PostgreSQL::Test::Cluster->new('node_2');
|
||||
$node_2->init_from_backup($node_1, $backup_name, has_streaming => 1);
|
||||
$node_2->start;
|
||||
|
||||
my $node_3 = PostgresNode->new('node_3');
|
||||
my $node_3 = PostgreSQL::Test::Cluster->new('node_3');
|
||||
$node_3->init_from_backup($node_1, $backup_name, has_streaming => 1);
|
||||
$node_3->start;
|
||||
|
||||
|
@ -40,9 +40,9 @@ use Exporter 'import';
|
||||
use File::Copy;
|
||||
use File::Path qw(rmtree);
|
||||
use IPC::Run qw(run);
|
||||
use PostgresNode;
|
||||
use RecursiveCopy;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::RecursiveCopy;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More;
|
||||
|
||||
our @EXPORT = qw(
|
||||
@ -128,7 +128,7 @@ sub setup_cluster
|
||||
|
||||
# Initialize primary, data checksums are mandatory
|
||||
$node_primary =
|
||||
PostgresNode->new('primary' . ($extra_name ? "_${extra_name}" : ''));
|
||||
PostgreSQL::Test::Cluster->new('primary' . ($extra_name ? "_${extra_name}" : ''));
|
||||
|
||||
# Set up pg_hba.conf and pg_ident.conf for the role running
|
||||
# pg_rewind. This role is used for all the tests, and has
|
||||
@ -176,7 +176,7 @@ sub create_standby
|
||||
my $extra_name = shift;
|
||||
|
||||
$node_standby =
|
||||
PostgresNode->new('standby' . ($extra_name ? "_${extra_name}" : ''));
|
||||
PostgreSQL::Test::Cluster->new('standby' . ($extra_name ? "_${extra_name}" : ''));
|
||||
$node_primary->backup('my_backup');
|
||||
$node_standby->init_from_backup($node_primary, 'my_backup');
|
||||
my $connstr_primary = $node_primary->connstr();
|
||||
@ -226,7 +226,7 @@ sub run_pg_rewind
|
||||
my $primary_pgdata = $node_primary->data_dir;
|
||||
my $standby_pgdata = $node_standby->data_dir;
|
||||
my $standby_connstr = $node_standby->connstr('postgres');
|
||||
my $tmp_folder = TestLib::tempdir;
|
||||
my $tmp_folder = PostgreSQL::Test::Utils::tempdir;
|
||||
|
||||
# Append the rewind-specific role to the connection string.
|
||||
$standby_connstr = "$standby_connstr user=rewind_user";
|
||||
@ -315,7 +315,7 @@ sub run_pg_rewind
|
||||
# segments from the old primary to the archives. These
|
||||
# will be used by pg_rewind.
|
||||
rmtree($node_primary->archive_dir);
|
||||
RecursiveCopy::copypath($node_primary->data_dir . "/pg_wal",
|
||||
PostgreSQL::Test::RecursiveCopy::copypath($node_primary->data_dir . "/pg_wal",
|
||||
$node_primary->archive_dir);
|
||||
|
||||
# Fast way to remove entire directory content
|
||||
|
@ -5,7 +5,7 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Config;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 12;
|
||||
|
||||
#########################################
|
||||
|
@ -5,7 +5,7 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Config;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 12;
|
||||
|
||||
#########################################
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 16;
|
||||
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||
|
||||
program_help_ok('pg_verifybackup');
|
||||
program_version_ok('pg_verifybackup');
|
||||
|
@ -8,11 +8,11 @@ use warnings;
|
||||
use Cwd;
|
||||
use Config;
|
||||
use File::Path qw(rmtree);
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 19;
|
||||
|
||||
my $primary = PostgresNode->new('primary');
|
||||
my $primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$primary->init(allows_streaming => 1);
|
||||
$primary->start;
|
||||
|
||||
|
@ -8,17 +8,17 @@ use warnings;
|
||||
use Cwd;
|
||||
use Config;
|
||||
use File::Path qw(rmtree);
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 44;
|
||||
|
||||
my $primary = PostgresNode->new('primary');
|
||||
my $primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$primary->init(allows_streaming => 1);
|
||||
$primary->start;
|
||||
|
||||
# Include a user-defined tablespace in the hopes of detecting problems in that
|
||||
# area.
|
||||
my $source_ts_path = TestLib::perl2host(TestLib::tempdir_short());
|
||||
my $source_ts_path = PostgreSQL::Test::Utils::perl2host(PostgreSQL::Test::Utils::tempdir_short());
|
||||
my $source_ts_prefix = $source_ts_path;
|
||||
$source_ts_prefix =~ s!(^[A-Z]:/[^/]*)/.*!$1!;
|
||||
|
||||
@ -107,7 +107,7 @@ for my $scenario (@scenario)
|
||||
|
||||
# Take a backup and check that it verifies OK.
|
||||
my $backup_path = $primary->backup_dir . '/' . $name;
|
||||
my $backup_ts_path = TestLib::perl2host(TestLib::tempdir_short());
|
||||
my $backup_ts_path = PostgreSQL::Test::Utils::perl2host(PostgreSQL::Test::Utils::tempdir_short());
|
||||
# The tablespace map parameter confuses Msys2, which tries to mangle
|
||||
# it. Tell it not to.
|
||||
# See https://www.msys2.org/wiki/Porting/#filesystem-namespaces
|
||||
|
@ -8,12 +8,12 @@ use warnings;
|
||||
use Cwd;
|
||||
use Config;
|
||||
use File::Path qw(rmtree);
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 25;
|
||||
|
||||
# Start up the server and take a backup.
|
||||
my $primary = PostgresNode->new('primary');
|
||||
my $primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$primary->init(allows_streaming => 1);
|
||||
$primary->start;
|
||||
my $backup_path = $primary->backup_dir . '/test_options';
|
||||
|
@ -8,11 +8,11 @@ use strict;
|
||||
use warnings;
|
||||
use Cwd;
|
||||
use Config;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 58;
|
||||
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||
|
||||
test_bad_manifest(
|
||||
'input string ended unexpectedly',
|
||||
|
@ -7,11 +7,11 @@ use strict;
|
||||
use warnings;
|
||||
use Cwd;
|
||||
use Config;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 5;
|
||||
|
||||
my $primary = PostgresNode->new('primary');
|
||||
my $primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$primary->init(allows_streaming => 1);
|
||||
$primary->start;
|
||||
my $backup_path = $primary->backup_dir . '/test_encoding';
|
||||
|
@ -8,12 +8,12 @@ use warnings;
|
||||
use Cwd;
|
||||
use Config;
|
||||
use File::Path qw(rmtree);
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 9;
|
||||
|
||||
# Start up the server and take a backup.
|
||||
my $primary = PostgresNode->new('primary');
|
||||
my $primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$primary->init(allows_streaming => 1);
|
||||
$primary->start;
|
||||
my $backup_path = $primary->backup_dir . '/test_wal';
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 8;
|
||||
|
||||
program_help_ok('pg_waldump');
|
||||
|
@ -4,13 +4,13 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More;
|
||||
use Config;
|
||||
|
||||
# start a pgbench specific server
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
@ -20,7 +20,7 @@ $node->start;
|
||||
my $ts = $node->basedir . '/regress_pgbench_tap_1_ts_dir';
|
||||
mkdir $ts or die "cannot create directory $ts";
|
||||
# this takes care of WIN-specific path issues
|
||||
my $ets = TestLib::perl2host($ts);
|
||||
my $ets = PostgreSQL::Test::Utils::perl2host($ts);
|
||||
|
||||
# the next commands will issue a syntax error if the path contains a "'"
|
||||
$node->safe_psql('postgres',
|
||||
@ -252,7 +252,7 @@ select $$'Valame Dios!' dijo Sancho; 'no le dije yo a vuestra merced que mirase
|
||||
select column1::jsonb from (values (:value), (:long)) as q;
|
||||
]
|
||||
});
|
||||
my $log = TestLib::slurp_file($node->logfile);
|
||||
my $log = PostgreSQL::Test::Utils::slurp_file($node->logfile);
|
||||
unlike(
|
||||
$log,
|
||||
qr[DETAIL: parameters: \$1 = '\{ invalid ',],
|
||||
@ -293,7 +293,7 @@ select $$'Valame Dios!' dijo Sancho; 'no le dije yo a vuestra merced que mirase
|
||||
select column1::jsonb from (values (:value), (:long)) as q;
|
||||
]
|
||||
});
|
||||
$log = TestLib::slurp_file($node->logfile);
|
||||
$log = PostgreSQL::Test::Utils::slurp_file($node->logfile);
|
||||
like(
|
||||
$log,
|
||||
qr[DETAIL: parameters: \$1 = '\{ invalid ', \$2 = '''Valame Dios!'' dijo Sancho; ''no le dije yo a vuestra merced que mirase bien lo que hacia\?'''],
|
||||
@ -338,7 +338,7 @@ select $$'Valame Dios!' dijo Sancho; 'no le dije yo a vuestra merced que mirase
|
||||
select column1::jsonb from (values (:value), (:long)) as q;
|
||||
]
|
||||
});
|
||||
$log = TestLib::slurp_file($node->logfile);
|
||||
$log = PostgreSQL::Test::Utils::slurp_file($node->logfile);
|
||||
like(
|
||||
$log,
|
||||
qr[DETAIL: parameters: \$1 = '\{ inval\.\.\.', \$2 = '''Valame\.\.\.'],
|
||||
|
@ -8,7 +8,7 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More;
|
||||
|
||||
# create a directory for scripts
|
||||
@ -16,7 +16,7 @@ my $testname = $0;
|
||||
$testname =~ s,.*/,,;
|
||||
$testname =~ s/\.pl$//;
|
||||
|
||||
my $testdir = "$TestLib::tmp_check/t_${testname}_stuff";
|
||||
my $testdir = "$PostgreSQL::Test::Utils::tmp_check/t_${testname}_stuff";
|
||||
mkdir $testdir
|
||||
or BAIL_OUT("could not create test directory \"${testdir}\": $!");
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 25;
|
||||
|
||||
program_help_ok('psql');
|
||||
@ -60,7 +60,7 @@ foreach my $arg (qw(commands variables))
|
||||
is($stderr, '', "psql --help=$arg nothing to stderr");
|
||||
}
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->append_conf(
|
||||
'postgresql.conf', q{
|
||||
|
@ -4,8 +4,8 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More;
|
||||
use IPC::Run qw(pump finish timer);
|
||||
use Data::Dumper;
|
||||
@ -34,7 +34,7 @@ if ($@)
|
||||
}
|
||||
|
||||
# start a new server
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
@ -48,7 +48,7 @@ $node->safe_psql('postgres',
|
||||
# their ~/.psql_history, so be sure to redirect history into a temp file.
|
||||
# We might as well put it in the test log directory, so that buildfarm runs
|
||||
# capture the result for possible debugging purposes.
|
||||
my $historyfile = "${TestLib::log_path}/010_psql_history.txt";
|
||||
my $historyfile = "${PostgreSQL::Test::Utils::log_path}/010_psql_history.txt";
|
||||
$ENV{PSQL_HISTORY} = $historyfile;
|
||||
|
||||
# Another pitfall for developers is that they might have a ~/.inputrc
|
||||
|
@ -4,14 +4,14 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 2;
|
||||
use Time::HiRes qw(usleep);
|
||||
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
@ -44,7 +44,7 @@ SKIP: {
|
||||
pump $h while length $stdin;
|
||||
my $count;
|
||||
my $psql_pid;
|
||||
until (-s "$tempdir/psql.pid" and ($psql_pid = TestLib::slurp_file("$tempdir/psql.pid")) =~ /^\d+\n/s)
|
||||
until (-s "$tempdir/psql.pid" and ($psql_pid = PostgreSQL::Test::Utils::slurp_file("$tempdir/psql.pid")) =~ /^\d+\n/s)
|
||||
{
|
||||
($count++ < 180 * 100) or die "pid file did not appear";
|
||||
usleep(10_000)
|
||||
|
@ -4,15 +4,15 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 14;
|
||||
|
||||
program_help_ok('clusterdb');
|
||||
program_version_ok('clusterdb');
|
||||
program_options_handling_ok('clusterdb');
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
|
@ -4,11 +4,11 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 2;
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
|
@ -4,15 +4,15 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 22;
|
||||
|
||||
program_help_ok('createdb');
|
||||
program_version_ok('createdb');
|
||||
program_options_handling_ok('createdb');
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
|
@ -4,15 +4,15 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 17;
|
||||
|
||||
program_help_ok('createuser');
|
||||
program_version_ok('createuser');
|
||||
program_options_handling_ok('createuser');
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
|
@ -4,15 +4,15 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 13;
|
||||
|
||||
program_help_ok('dropdb');
|
||||
program_version_ok('dropdb');
|
||||
program_options_handling_ok('dropdb');
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
|
@ -4,15 +4,15 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 11;
|
||||
|
||||
program_help_ok('dropuser');
|
||||
program_version_ok('dropuser');
|
||||
program_options_handling_ok('dropuser');
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 10;
|
||||
|
||||
program_help_ok('pg_isready');
|
||||
@ -14,7 +14,7 @@ program_options_handling_ok('pg_isready');
|
||||
|
||||
command_fails(['pg_isready'], 'fails with no server running');
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
|
@ -4,15 +4,15 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 58;
|
||||
|
||||
program_help_ok('reindexdb');
|
||||
program_version_ok('reindexdb');
|
||||
program_options_handling_ok('reindexdb');
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
@ -21,7 +21,7 @@ $ENV{PGOPTIONS} = '--client-min-messages=WARNING';
|
||||
# Create a tablespace for testing.
|
||||
my $tbspace_path = $node->basedir . '/regress_reindex_tbspace';
|
||||
mkdir $tbspace_path or die "cannot create directory $tbspace_path";
|
||||
$tbspace_path = TestLib::perl2host($tbspace_path);
|
||||
$tbspace_path = PostgreSQL::Test::Utils::perl2host($tbspace_path);
|
||||
my $tbspace_name = 'reindex_tbspace';
|
||||
$node->safe_psql('postgres',
|
||||
"CREATE TABLESPACE $tbspace_name LOCATION '$tbspace_path';");
|
||||
|
@ -4,10 +4,10 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use Test::More tests => 2;
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
|
@ -4,15 +4,15 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 58;
|
||||
|
||||
program_help_ok('vacuumdb');
|
||||
program_version_ok('vacuumdb');
|
||||
program_options_handling_ok('vacuumdb');
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use Test::More tests => 2;
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use Test::More tests => 4;
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 3;
|
||||
|
||||
# Tests to check connection string handling in utilities
|
||||
@ -23,7 +23,7 @@ my $dbname2 =
|
||||
my $dbname3 = generate_ascii_string(130, 192);
|
||||
my $dbname4 = generate_ascii_string(193, 255);
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init(extra => [ '--locale=C', '--encoding=LATIN1' ]);
|
||||
$node->start;
|
||||
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More;
|
||||
if (!$use_unix_sockets)
|
||||
{
|
||||
@ -64,7 +64,7 @@ sub test_role
|
||||
}
|
||||
|
||||
# Initialize primary node
|
||||
my $node = PostgresNode->new('primary');
|
||||
my $node = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node->init;
|
||||
$node->append_conf('postgresql.conf', "log_connections = on\n");
|
||||
$node->start;
|
||||
@ -136,7 +136,7 @@ $ENV{"PGCHANNELBINDING"} = 'require';
|
||||
test_role($node, 'scram_role', 'scram-sha-256', 2);
|
||||
|
||||
# Test .pgpass processing; but use a temp file, don't overwrite the real one!
|
||||
my $pgpassfile = "${TestLib::tmp_check}/pgpass";
|
||||
my $pgpassfile = "${PostgreSQL::Test::Utils::tmp_check}/pgpass";
|
||||
|
||||
delete $ENV{"PGPASSWORD"};
|
||||
delete $ENV{"PGCHANNELBINDING"};
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More;
|
||||
if (!$use_unix_sockets)
|
||||
{
|
||||
@ -64,7 +64,7 @@ sub test_login
|
||||
|
||||
# Initialize primary node. Force UTF-8 encoding, so that we can use non-ASCII
|
||||
# characters in the passwords below.
|
||||
my $node = PostgresNode->new('primary');
|
||||
my $node = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node->init(extra => [ '--locale=C', '--encoding=UTF8' ]);
|
||||
$node->start;
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgresNode;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use Test::More;
|
||||
use Time::HiRes qw(usleep);
|
||||
|
||||
@ -69,15 +69,15 @@ my $host = 'auth-test-localhost.postgresql.example.com';
|
||||
my $hostaddr = '127.0.0.1';
|
||||
my $realm = 'EXAMPLE.COM';
|
||||
|
||||
my $krb5_conf = "${TestLib::tmp_check}/krb5.conf";
|
||||
my $kdc_conf = "${TestLib::tmp_check}/kdc.conf";
|
||||
my $krb5_cache = "${TestLib::tmp_check}/krb5cc";
|
||||
my $krb5_log = "${TestLib::log_path}/krb5libs.log";
|
||||
my $kdc_log = "${TestLib::log_path}/krb5kdc.log";
|
||||
my $kdc_port = PostgresNode::get_free_port();
|
||||
my $kdc_datadir = "${TestLib::tmp_check}/krb5kdc";
|
||||
my $kdc_pidfile = "${TestLib::tmp_check}/krb5kdc.pid";
|
||||
my $keytab = "${TestLib::tmp_check}/krb5.keytab";
|
||||
my $krb5_conf = "${PostgreSQL::Test::Utils::tmp_check}/krb5.conf";
|
||||
my $kdc_conf = "${PostgreSQL::Test::Utils::tmp_check}/kdc.conf";
|
||||
my $krb5_cache = "${PostgreSQL::Test::Utils::tmp_check}/krb5cc";
|
||||
my $krb5_log = "${PostgreSQL::Test::Utils::log_path}/krb5libs.log";
|
||||
my $kdc_log = "${PostgreSQL::Test::Utils::log_path}/krb5kdc.log";
|
||||
my $kdc_port = PostgreSQL::Test::Cluster::get_free_port();
|
||||
my $kdc_datadir = "${PostgreSQL::Test::Utils::tmp_check}/krb5kdc";
|
||||
my $kdc_pidfile = "${PostgreSQL::Test::Utils::tmp_check}/krb5kdc.pid";
|
||||
my $keytab = "${PostgreSQL::Test::Utils::tmp_check}/krb5.keytab";
|
||||
|
||||
my $dbname = 'postgres';
|
||||
my $username = 'test1';
|
||||
@ -167,7 +167,7 @@ END
|
||||
|
||||
note "setting up PostgreSQL instance";
|
||||
|
||||
my $node = PostgresNode->new('node');
|
||||
my $node = PostgreSQL::Test::Cluster->new('node');
|
||||
$node->init;
|
||||
$node->append_conf(
|
||||
'postgresql.conf', qq{
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use TestLib;
|
||||
use PostgresNode;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use Test::More;
|
||||
|
||||
if ($ENV{with_ldap} eq 'yes')
|
||||
@ -51,21 +51,21 @@ elsif ($^O eq 'freebsd')
|
||||
|
||||
$ENV{PATH} = "$ldap_bin_dir:$ENV{PATH}" if $ldap_bin_dir;
|
||||
|
||||
my $ldap_datadir = "${TestLib::tmp_check}/openldap-data";
|
||||
my $slapd_certs = "${TestLib::tmp_check}/slapd-certs";
|
||||
my $slapd_conf = "${TestLib::tmp_check}/slapd.conf";
|
||||
my $slapd_pidfile = "${TestLib::tmp_check}/slapd.pid";
|
||||
my $slapd_logfile = "${TestLib::log_path}/slapd.log";
|
||||
my $ldap_conf = "${TestLib::tmp_check}/ldap.conf";
|
||||
my $ldap_datadir = "${PostgreSQL::Test::Utils::tmp_check}/openldap-data";
|
||||
my $slapd_certs = "${PostgreSQL::Test::Utils::tmp_check}/slapd-certs";
|
||||
my $slapd_conf = "${PostgreSQL::Test::Utils::tmp_check}/slapd.conf";
|
||||
my $slapd_pidfile = "${PostgreSQL::Test::Utils::tmp_check}/slapd.pid";
|
||||
my $slapd_logfile = "${PostgreSQL::Test::Utils::log_path}/slapd.log";
|
||||
my $ldap_conf = "${PostgreSQL::Test::Utils::tmp_check}/ldap.conf";
|
||||
my $ldap_server = 'localhost';
|
||||
my $ldap_port = PostgresNode::get_free_port();
|
||||
my $ldaps_port = PostgresNode::get_free_port();
|
||||
my $ldap_port = PostgreSQL::Test::Cluster::get_free_port();
|
||||
my $ldaps_port = PostgreSQL::Test::Cluster::get_free_port();
|
||||
my $ldap_url = "ldap://$ldap_server:$ldap_port";
|
||||
my $ldaps_url = "ldaps://$ldap_server:$ldaps_port";
|
||||
my $ldap_basedn = 'dc=example,dc=net';
|
||||
my $ldap_rootdn = 'cn=Manager,dc=example,dc=net';
|
||||
my $ldap_rootpw = 'secret';
|
||||
my $ldap_pwfile = "${TestLib::tmp_check}/ldappassword";
|
||||
my $ldap_pwfile = "${PostgreSQL::Test::Utils::tmp_check}/ldappassword";
|
||||
|
||||
note "setting up slapd";
|
||||
|
||||
@ -155,7 +155,7 @@ system_or_bail 'ldappasswd', '-x', '-y', $ldap_pwfile, '-s', 'secret2',
|
||||
|
||||
note "setting up PostgreSQL instance";
|
||||
|
||||
my $node = PostgresNode->new('node');
|
||||
my $node = PostgreSQL::Test::Cluster->new('node');
|
||||
$node->init;
|
||||
$node->append_conf('postgresql.conf', "log_connections = on\n");
|
||||
$node->start;
|
||||
|
@ -6,11 +6,11 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 2;
|
||||
use PostgresNode;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
|
||||
my $node = PostgresNode->new('tango');
|
||||
my $node = PostgreSQL::Test::Cluster->new('tango');
|
||||
$node->init;
|
||||
$node->append_conf('postgresql.conf', 'autovacuum_naptime=1s');
|
||||
$node->start;
|
||||
|
@ -6,11 +6,11 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 2;
|
||||
use PostgresNode;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
|
||||
my $node = PostgresNode->new('foxtrot');
|
||||
my $node = PostgreSQL::Test::Cluster->new('foxtrot');
|
||||
$node->init;
|
||||
$node->append_conf('postgresql.conf', 'track_commit_timestamp = on');
|
||||
$node->start;
|
||||
|
@ -6,12 +6,12 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 4;
|
||||
use PostgresNode;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
|
||||
my $bkplabel = 'backup';
|
||||
my $primary = PostgresNode->new('primary');
|
||||
my $primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$primary->init(allows_streaming => 1);
|
||||
|
||||
$primary->append_conf(
|
||||
@ -22,7 +22,7 @@ $primary->append_conf(
|
||||
$primary->start;
|
||||
$primary->backup($bkplabel);
|
||||
|
||||
my $standby = PostgresNode->new('standby');
|
||||
my $standby = PostgreSQL::Test::Cluster->new('standby');
|
||||
$standby->init_from_backup($primary, $bkplabel, has_streaming => 1);
|
||||
$standby->start;
|
||||
|
||||
|
@ -6,12 +6,12 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 4;
|
||||
use PostgresNode;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
|
||||
my $bkplabel = 'backup';
|
||||
my $primary = PostgresNode->new('primary');
|
||||
my $primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$primary->init(allows_streaming => 1);
|
||||
$primary->append_conf(
|
||||
'postgresql.conf', qq{
|
||||
@ -21,7 +21,7 @@ $primary->append_conf(
|
||||
$primary->start;
|
||||
$primary->backup($bkplabel);
|
||||
|
||||
my $standby = PostgresNode->new('standby');
|
||||
my $standby = PostgreSQL::Test::Cluster->new('standby');
|
||||
$standby->init_from_backup($primary, $bkplabel, has_streaming => 1);
|
||||
$standby->start;
|
||||
|
||||
|
@ -4,11 +4,11 @@
|
||||
# Testing of commit timestamps preservation across restarts
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 16;
|
||||
|
||||
my $node_primary = PostgresNode->new('primary');
|
||||
my $node_primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node_primary->init(allows_streaming => 1);
|
||||
$node_primary->append_conf('postgresql.conf', 'track_commit_timestamp = on');
|
||||
$node_primary->start;
|
||||
|
@ -5,11 +5,11 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Config;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More;
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
@ -19,7 +19,7 @@ my ($out, $err) = run_command([ 'libpq_pipeline', 'tests' ]);
|
||||
die "oops: $err" unless $err eq '';
|
||||
my @tests = split(/\s+/, $out);
|
||||
|
||||
mkdir "$TestLib::tmp_check/traces";
|
||||
mkdir "$PostgreSQL::Test::Utils::tmp_check/traces";
|
||||
|
||||
for my $testname (@tests)
|
||||
{
|
||||
@ -29,7 +29,7 @@ for my $testname (@tests)
|
||||
pipeline_abort transaction disallowed_in_pipeline)) > 0;
|
||||
|
||||
# For a bunch of tests, generate a libpq trace file too.
|
||||
my $traceout = "$TestLib::tmp_check/traces/$testname.trace";
|
||||
my $traceout = "$PostgreSQL::Test::Utils::tmp_check/traces/$testname.trace";
|
||||
if ($cmptrace)
|
||||
{
|
||||
push @extraargs, "-t", $traceout;
|
||||
|
@ -6,9 +6,9 @@ use warnings;
|
||||
|
||||
use File::Copy;
|
||||
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More;
|
||||
use PostgresNode;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
|
||||
unless (($ENV{with_ssl} || "") eq 'openssl')
|
||||
{
|
||||
@ -20,7 +20,7 @@ my $rot13pass = "SbbOnE1";
|
||||
|
||||
# see the Makefile for how the certificate and key have been generated
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->append_conf('postgresql.conf',
|
||||
"ssl_passphrase.passphrase = '$rot13pass'");
|
||||
@ -63,7 +63,7 @@ like(
|
||||
$node->append_conf('postgresql.conf', "ssl_passphrase.passphrase = 'blurfl'");
|
||||
|
||||
# try to start the server again
|
||||
my $ret = TestLib::system_log('pg_ctl', '-D', $node->data_dir, '-l',
|
||||
my $ret = PostgreSQL::Test::Utils::system_log('pg_ctl', '-D', $node->data_dir, '-l',
|
||||
$node->logfile, 'start');
|
||||
|
||||
|
||||
|
@ -5,12 +5,12 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 42;
|
||||
|
||||
# Initialize a test cluster
|
||||
my $node = PostgresNode->new('primary');
|
||||
my $node = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node->init();
|
||||
# Turn message level up to DEBUG1 so that we get the messages we want to see
|
||||
$node->append_conf('postgresql.conf', 'client_min_messages = DEBUG1');
|
||||
|
@ -5,11 +5,11 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Config;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More;
|
||||
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||
|
||||
###############################################################
|
||||
# This structure is based off of the src/bin/pg_dump/t test
|
||||
@ -28,7 +28,7 @@ my $tempdir = TestLib::tempdir;
|
||||
# the full command and arguments to run. Note that this is run
|
||||
# using $node->command_ok(), so the port does not need to be
|
||||
# specified and is pulled from $PGPORT, which is set by the
|
||||
# PostgresNode system.
|
||||
# PostgreSQL::Test::Cluster system.
|
||||
#
|
||||
# restore_cmd is the pg_restore command to run, if any. Note
|
||||
# that this should generally be used when the pg_dump goes to
|
||||
@ -712,7 +712,7 @@ my %tests = (
|
||||
#########################################
|
||||
# Create a PG instance to test actually dumping from
|
||||
|
||||
my $node = PostgresNode->new('main');
|
||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
|
@ -16,20 +16,20 @@ include $(top_builddir)/src/Makefile.global
|
||||
ifeq ($(enable_tap_tests),yes)
|
||||
|
||||
installdirs:
|
||||
$(MKDIR_P) '$(DESTDIR)$(pgxsdir)/$(subdir)'
|
||||
$(MKDIR_P) '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test'
|
||||
|
||||
install: all installdirs
|
||||
$(INSTALL_DATA) $(srcdir)/TestLib.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/TestLib.pm'
|
||||
$(INSTALL_DATA) $(srcdir)/SimpleTee.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/SimpleTee.pm'
|
||||
$(INSTALL_DATA) $(srcdir)/RecursiveCopy.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/RecursiveCopy.pm'
|
||||
$(INSTALL_DATA) $(srcdir)/PostgresNode.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgresNode.pm'
|
||||
$(INSTALL_DATA) $(srcdir)/PostgresVersion.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgresVersion.pm'
|
||||
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/Utils.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Utils.pm'
|
||||
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/SimpleTee.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/SimpleTee.pm'
|
||||
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/RecursiveCopy.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/RecursiveCopy.pm'
|
||||
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/Cluster.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
|
||||
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Version.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
|
||||
|
||||
uninstall:
|
||||
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/TestLib.pm'
|
||||
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/SimpleTee.pm'
|
||||
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/RecursiveCopy.pm'
|
||||
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgresNode.pm'
|
||||
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgresVersion.pm'
|
||||
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Utils.pm'
|
||||
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/SimpleTee.pm'
|
||||
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/RecursiveCopy.pm'
|
||||
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
|
||||
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
|
||||
|
||||
endif
|
||||
|
@ -5,13 +5,13 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
PostgresNode - class representing PostgreSQL server instance
|
||||
PostgreSQL::Test::Cluster - class representing PostgreSQL server instance
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use PostgresNode;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
|
||||
my $node = PostgresNode->new('mynode');
|
||||
my $node = PostgreSQL::Test::Cluster->new('mynode');
|
||||
|
||||
# Create a data directory with initdb
|
||||
$node->init();
|
||||
@ -61,7 +61,7 @@ PostgresNode - class representing PostgreSQL server instance
|
||||
my $ret = $node->backup_fs_cold('testbackup3')
|
||||
|
||||
# Restore it to create a new independent node (not a replica)
|
||||
my $other_node = PostgresNode->new('mycopy');
|
||||
my $other_node = PostgreSQL::Test::Cluster->new('mycopy');
|
||||
$other_node->init_from_backup($node, 'testbackup');
|
||||
$other_node->start;
|
||||
|
||||
@ -69,15 +69,15 @@ PostgresNode - class representing PostgreSQL server instance
|
||||
$node->stop('fast');
|
||||
|
||||
# Find a free, unprivileged TCP port to bind some other service to
|
||||
my $port = PostgresNode::get_free_port();
|
||||
my $port = PostgreSQL::Test::Cluster::get_free_port();
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
PostgresNode contains a set of routines able to work on a PostgreSQL node,
|
||||
PostgreSQL::Test::Cluster contains a set of routines able to work on a PostgreSQL node,
|
||||
allowing to start, stop, backup and initialize it with various options.
|
||||
The set of nodes managed by a given test is also managed by this module.
|
||||
|
||||
In addition to node management, PostgresNode instances have some wrappers
|
||||
In addition to node management, PostgreSQL::Test::Cluster instances have some wrappers
|
||||
around Test::More functions to run commands with an environment set up to
|
||||
point to the instance.
|
||||
|
||||
@ -85,7 +85,7 @@ The IPC::Run module is required.
|
||||
|
||||
=cut
|
||||
|
||||
package PostgresNode;
|
||||
package PostgreSQL::Test::Cluster;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
@ -100,11 +100,11 @@ use File::Spec;
|
||||
use File::stat qw(stat);
|
||||
use File::Temp ();
|
||||
use IPC::Run;
|
||||
use PostgresVersion;
|
||||
use RecursiveCopy;
|
||||
use PostgreSQL::Version;
|
||||
use PostgreSQL::Test::RecursiveCopy;
|
||||
use Socket;
|
||||
use Test::More;
|
||||
use TestLib ();
|
||||
use PostgreSQL::Test::Utils ();
|
||||
use Time::HiRes qw(usleep);
|
||||
use Scalar::Util qw(blessed);
|
||||
|
||||
@ -116,10 +116,10 @@ INIT
|
||||
|
||||
# Set PGHOST for backward compatibility. This doesn't work for own_host
|
||||
# nodes, so prefer to not rely on this when writing new tests.
|
||||
$use_tcp = !$TestLib::use_unix_sockets;
|
||||
$use_tcp = !$PostgreSQL::Test::Utils::use_unix_sockets;
|
||||
$test_localhost = "127.0.0.1";
|
||||
$last_host_assigned = 1;
|
||||
$test_pghost = $use_tcp ? $test_localhost : TestLib::tempdir_short;
|
||||
$test_pghost = $use_tcp ? $test_localhost : PostgreSQL::Test::Utils::tempdir_short;
|
||||
$ENV{PGHOST} = $test_pghost;
|
||||
$ENV{PGDATABASE} = 'postgres';
|
||||
|
||||
@ -369,8 +369,8 @@ sub set_replication_conf
|
||||
or croak "set_replication_conf only works with the default host";
|
||||
|
||||
open my $hba, '>>', "$pgdata/pg_hba.conf";
|
||||
print $hba "\n# Allow replication (set up by PostgresNode.pm)\n";
|
||||
if ($TestLib::windows_os && !$TestLib::use_unix_sockets)
|
||||
print $hba "\n# Allow replication (set up by PostgreSQL::Test::Cluster.pm)\n";
|
||||
if ($PostgreSQL::Test::Utils::windows_os && !$PostgreSQL::Test::Utils::use_unix_sockets)
|
||||
{
|
||||
print $hba
|
||||
"host replication all $test_localhost/32 sspi include_realm=1 map=regress\n";
|
||||
@ -419,13 +419,13 @@ sub init
|
||||
mkdir $self->backup_dir;
|
||||
mkdir $self->archive_dir;
|
||||
|
||||
TestLib::system_or_bail('initdb', '-D', $pgdata, '-A', 'trust', '-N',
|
||||
PostgreSQL::Test::Utils::system_or_bail('initdb', '-D', $pgdata, '-A', 'trust', '-N',
|
||||
@{ $params{extra} });
|
||||
TestLib::system_or_bail($ENV{PG_REGRESS}, '--config-auth', $pgdata,
|
||||
PostgreSQL::Test::Utils::system_or_bail($ENV{PG_REGRESS}, '--config-auth', $pgdata,
|
||||
@{ $params{auth_extra} });
|
||||
|
||||
open my $conf, '>>', "$pgdata/postgresql.conf";
|
||||
print $conf "\n# Added by PostgresNode.pm\n";
|
||||
print $conf "\n# Added by PostgreSQL::Test::Cluster.pm\n";
|
||||
print $conf "fsync = off\n";
|
||||
print $conf "restart_after_crash = off\n";
|
||||
print $conf "log_line_prefix = '%m [%p] %q%a '\n";
|
||||
@ -437,7 +437,7 @@ sub init
|
||||
# TEMP_CONFIG. Otherwise, print it before TEMP_CONFIG, thereby permitting
|
||||
# overrides. Settings that merely improve performance or ease debugging
|
||||
# belong before TEMP_CONFIG.
|
||||
print $conf TestLib::slurp_file($ENV{TEMP_CONFIG})
|
||||
print $conf PostgreSQL::Test::Utils::slurp_file($ENV{TEMP_CONFIG})
|
||||
if defined $ENV{TEMP_CONFIG};
|
||||
|
||||
# XXX Neutralize any stats_temp_directory in TEMP_CONFIG. Nodes running
|
||||
@ -510,7 +510,7 @@ sub append_conf
|
||||
|
||||
my $conffile = $self->data_dir . '/' . $filename;
|
||||
|
||||
TestLib::append_to_file($conffile, $str . "\n");
|
||||
PostgreSQL::Test::Utils::append_to_file($conffile, $str . "\n");
|
||||
|
||||
chmod($self->group_access() ? 0640 : 0600, $conffile)
|
||||
or die("unable to set permissions for $conffile");
|
||||
@ -538,7 +538,7 @@ sub adjust_conf
|
||||
|
||||
my $conffile = $self->data_dir . '/' . $filename;
|
||||
|
||||
my $contents = TestLib::slurp_file($conffile);
|
||||
my $contents = PostgreSQL::Test::Utils::slurp_file($conffile);
|
||||
my @lines = split(/\n/, $contents);
|
||||
my @result;
|
||||
my $eq = $skip_equals ? '' : '= ';
|
||||
@ -587,7 +587,7 @@ sub backup
|
||||
local %ENV = $self->_get_env();
|
||||
|
||||
print "# Taking pg_basebackup $backup_name from node \"$name\"\n";
|
||||
TestLib::system_or_bail(
|
||||
PostgreSQL::Test::Utils::system_or_bail(
|
||||
'pg_basebackup', '-D',
|
||||
$backup_path, '-h',
|
||||
$self->host, '-p',
|
||||
@ -652,7 +652,7 @@ sub _backup_fs
|
||||
print "# pg_start_backup: $stdout\n";
|
||||
}
|
||||
|
||||
RecursiveCopy::copypath(
|
||||
PostgreSQL::Test::RecursiveCopy::copypath(
|
||||
$self->data_dir,
|
||||
$backup_path,
|
||||
filterfn => sub {
|
||||
@ -682,7 +682,7 @@ sub _backup_fs
|
||||
=item $node->init_from_backup(root_node, backup_name)
|
||||
|
||||
Initialize a node from a backup, which may come from this node or a different
|
||||
node. root_node must be a PostgresNode reference, backup_name the string name
|
||||
node. root_node must be a PostgreSQL::Test::Cluster reference, backup_name the string name
|
||||
of a backup previously created on that node with $node->backup.
|
||||
|
||||
Does not start the node after initializing it.
|
||||
@ -732,10 +732,10 @@ sub init_from_backup
|
||||
if (defined $params{tar_program})
|
||||
{
|
||||
mkdir($data_path);
|
||||
TestLib::system_or_bail($params{tar_program}, 'xf',
|
||||
PostgreSQL::Test::Utils::system_or_bail($params{tar_program}, 'xf',
|
||||
$backup_path . '/base.tar',
|
||||
'-C', $data_path);
|
||||
TestLib::system_or_bail(
|
||||
PostgreSQL::Test::Utils::system_or_bail(
|
||||
$params{tar_program}, 'xf',
|
||||
$backup_path . '/pg_wal.tar', '-C',
|
||||
$data_path . '/pg_wal');
|
||||
@ -743,7 +743,7 @@ sub init_from_backup
|
||||
else
|
||||
{
|
||||
rmdir($data_path);
|
||||
RecursiveCopy::copypath($backup_path, $data_path);
|
||||
PostgreSQL::Test::RecursiveCopy::copypath($backup_path, $data_path);
|
||||
}
|
||||
chmod(0700, $data_path);
|
||||
|
||||
@ -827,13 +827,13 @@ sub start
|
||||
# sub init) so that it does not get copied to standbys.
|
||||
# -w is now the default but having it here does no harm and helps
|
||||
# compatibility with older versions.
|
||||
$ret = TestLib::system_log('pg_ctl', '-w', '-D', $self->data_dir, '-l',
|
||||
$ret = PostgreSQL::Test::Utils::system_log('pg_ctl', '-w', '-D', $self->data_dir, '-l',
|
||||
$self->logfile, '-o', "--cluster-name=$name", 'start');
|
||||
|
||||
if ($ret != 0)
|
||||
{
|
||||
print "# pg_ctl start failed; logfile:\n";
|
||||
print TestLib::slurp_file($self->logfile);
|
||||
print PostgreSQL::Test::Utils::slurp_file($self->logfile);
|
||||
BAIL_OUT("pg_ctl start failed") unless $params{fail_ok};
|
||||
return 0;
|
||||
}
|
||||
@ -865,7 +865,7 @@ sub kill9
|
||||
print "### Killing node \"$name\" using signal 9\n";
|
||||
# kill(9, ...) fails under msys Perl 5.8.8, so fall back on pg_ctl.
|
||||
kill(9, $self->{_pid})
|
||||
or TestLib::system_or_bail('pg_ctl', 'kill', 'KILL', $self->{_pid});
|
||||
or PostgreSQL::Test::Utils::system_or_bail('pg_ctl', 'kill', 'KILL', $self->{_pid});
|
||||
$self->{_pid} = undef;
|
||||
return;
|
||||
}
|
||||
@ -894,7 +894,7 @@ sub stop
|
||||
$mode = 'fast' unless defined $mode;
|
||||
return unless defined $self->{_pid};
|
||||
print "### Stopping node \"$name\" using mode $mode\n";
|
||||
TestLib::system_or_bail('pg_ctl', '-D', $pgdata, '-m', $mode, 'stop');
|
||||
PostgreSQL::Test::Utils::system_or_bail('pg_ctl', '-D', $pgdata, '-m', $mode, 'stop');
|
||||
$self->_update_pid(0);
|
||||
return;
|
||||
}
|
||||
@ -917,7 +917,7 @@ sub reload
|
||||
local %ENV = $self->_get_env();
|
||||
|
||||
print "### Reloading node \"$name\"\n";
|
||||
TestLib::system_or_bail('pg_ctl', '-D', $pgdata, 'reload');
|
||||
PostgreSQL::Test::Utils::system_or_bail('pg_ctl', '-D', $pgdata, 'reload');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -943,7 +943,7 @@ sub restart
|
||||
|
||||
# -w is now the default but having it here does no harm and helps
|
||||
# compatibility with older versions.
|
||||
TestLib::system_or_bail('pg_ctl', '-w', '-D', $pgdata, '-l', $logfile,
|
||||
PostgreSQL::Test::Utils::system_or_bail('pg_ctl', '-w', '-D', $pgdata, '-l', $logfile,
|
||||
'restart');
|
||||
|
||||
$self->_update_pid(1);
|
||||
@ -969,7 +969,7 @@ sub promote
|
||||
local %ENV = $self->_get_env();
|
||||
|
||||
print "### Promoting node \"$name\"\n";
|
||||
TestLib::system_or_bail('pg_ctl', '-D', $pgdata, '-l', $logfile,
|
||||
PostgreSQL::Test::Utils::system_or_bail('pg_ctl', '-D', $pgdata, '-l', $logfile,
|
||||
'promote');
|
||||
return;
|
||||
}
|
||||
@ -993,7 +993,7 @@ sub logrotate
|
||||
local %ENV = $self->_get_env();
|
||||
|
||||
print "### Rotating log in node \"$name\"\n";
|
||||
TestLib::system_or_bail('pg_ctl', '-D', $pgdata, '-l', $logfile,
|
||||
PostgreSQL::Test::Utils::system_or_bail('pg_ctl', '-D', $pgdata, '-l', $logfile,
|
||||
'logrotate');
|
||||
return;
|
||||
}
|
||||
@ -1018,7 +1018,7 @@ primary_conninfo='$root_connstr'
|
||||
sub enable_restoring
|
||||
{
|
||||
my ($self, $root_node, $standby) = @_;
|
||||
my $path = TestLib::perl2host($root_node->archive_dir);
|
||||
my $path = PostgreSQL::Test::Utils::perl2host($root_node->archive_dir);
|
||||
my $name = $self->name;
|
||||
|
||||
print "### Enabling WAL restore for node \"$name\"\n";
|
||||
@ -1029,9 +1029,9 @@ sub enable_restoring
|
||||
# in this routine, using only one back-slash, need to be properly changed
|
||||
# first. Paths also need to be double-quoted to prevent failures where
|
||||
# the path contains spaces.
|
||||
$path =~ s{\\}{\\\\}g if ($TestLib::windows_os);
|
||||
$path =~ s{\\}{\\\\}g if ($PostgreSQL::Test::Utils::windows_os);
|
||||
my $copy_command =
|
||||
$TestLib::windows_os
|
||||
$PostgreSQL::Test::Utils::windows_os
|
||||
? qq{copy "$path\\\\%f" "%p"}
|
||||
: qq{cp "$path/%f" "%p"};
|
||||
|
||||
@ -1086,7 +1086,7 @@ sub set_standby_mode
|
||||
sub enable_archiving
|
||||
{
|
||||
my ($self) = @_;
|
||||
my $path = TestLib::perl2host($self->archive_dir);
|
||||
my $path = PostgreSQL::Test::Utils::perl2host($self->archive_dir);
|
||||
my $name = $self->name;
|
||||
|
||||
print "### Enabling WAL archiving for node \"$name\"\n";
|
||||
@ -1097,9 +1097,9 @@ sub enable_archiving
|
||||
# in this routine, using only one back-slash, need to be properly changed
|
||||
# first. Paths also need to be double-quoted to prevent failures where
|
||||
# the path contains spaces.
|
||||
$path =~ s{\\}{\\\\}g if ($TestLib::windows_os);
|
||||
$path =~ s{\\}{\\\\}g if ($PostgreSQL::Test::Utils::windows_os);
|
||||
my $copy_command =
|
||||
$TestLib::windows_os
|
||||
$PostgreSQL::Test::Utils::windows_os
|
||||
? qq{copy "%p" "$path\\\\%f"}
|
||||
: qq{cp "%p" "$path/%f"};
|
||||
|
||||
@ -1141,9 +1141,9 @@ sub _update_pid
|
||||
|
||||
=pod
|
||||
|
||||
=item PostgresNode->new(node_name, %params)
|
||||
=item PostgreSQL::Test::Cluster->new(node_name, %params)
|
||||
|
||||
Build a new object of class C<PostgresNode> (or of a subclass, if you have
|
||||
Build a new object of class C<PostgreSQL::Test::Cluster> (or of a subclass, if you have
|
||||
one), assigning a free port number. Remembers the node, to prevent its port
|
||||
number from being reused for another node, and to ensure that it gets
|
||||
shut down when the test script exits.
|
||||
@ -1216,11 +1216,11 @@ sub new
|
||||
my $node = {
|
||||
_port => $port,
|
||||
_host => $host,
|
||||
_basedir => "$TestLib::tmp_check/t_${testname}_${name}_data",
|
||||
_basedir => "$PostgreSQL::Test::Utils::tmp_check/t_${testname}_${name}_data",
|
||||
_name => $name,
|
||||
_logfile_generation => 0,
|
||||
_logfile_base => "$TestLib::log_path/${testname}_${name}",
|
||||
_logfile => "$TestLib::log_path/${testname}_${name}.log"
|
||||
_logfile_base => "$PostgreSQL::Test::Utils::log_path/${testname}_${name}",
|
||||
_logfile => "$PostgreSQL::Test::Utils::log_path/${testname}_${name}.log"
|
||||
};
|
||||
|
||||
if ($params{install_path})
|
||||
@ -1242,7 +1242,7 @@ sub new
|
||||
|
||||
my $v = $node->{_pg_version};
|
||||
|
||||
carp("PostgresNode isn't fully compatible with version " . $v)
|
||||
carp("PostgreSQL::Test::Cluster isn't fully compatible with version " . $v)
|
||||
if $v < 12;
|
||||
|
||||
return $node;
|
||||
@ -1272,9 +1272,9 @@ sub _set_pg_version
|
||||
$pg_config = "$inst/bin/pg_config";
|
||||
BAIL_OUT("pg_config not found: $pg_config")
|
||||
unless -e $pg_config
|
||||
or ($TestLib::windows_os and -e "$pg_config.exe");
|
||||
or ($PostgreSQL::Test::Utils::windows_os and -e "$pg_config.exe");
|
||||
BAIL_OUT("pg_config not executable: $pg_config")
|
||||
unless $TestLib::windows_os or -x $pg_config;
|
||||
unless $PostgreSQL::Test::Utils::windows_os or -x $pg_config;
|
||||
|
||||
# Leave $pg_config install_path qualified, to be sure we get the right
|
||||
# version information, below, or die trying
|
||||
@ -1286,7 +1286,7 @@ sub _set_pg_version
|
||||
my $version_line = qx{$pg_config --version};
|
||||
BAIL_OUT("$pg_config failed: $!") if $?;
|
||||
|
||||
$self->{_pg_version} = PostgresVersion->new($version_line);
|
||||
$self->{_pg_version} = PostgreSQL::Version->new($version_line);
|
||||
|
||||
BAIL_OUT("could not parse pg_config --version output: $version_line")
|
||||
unless defined $self->{_pg_version};
|
||||
@ -1331,7 +1331,7 @@ sub _get_env
|
||||
my $inst = $self->{_install_path};
|
||||
if ($inst)
|
||||
{
|
||||
if ($TestLib::windows_os)
|
||||
if ($PostgreSQL::Test::Utils::windows_os)
|
||||
{
|
||||
# Windows picks up DLLs from the PATH rather than *LD_LIBRARY_PATH
|
||||
# choose the right path separator
|
||||
@ -1394,14 +1394,14 @@ Locate an unprivileged (high) TCP port that's not currently bound to
|
||||
anything. This is used by C<new()>, and also by some test cases that need to
|
||||
start other, non-Postgres servers.
|
||||
|
||||
Ports assigned to existing PostgresNode objects are automatically
|
||||
Ports assigned to existing PostgreSQL::Test::Cluster objects are automatically
|
||||
excluded, even if those servers are not currently running.
|
||||
|
||||
XXX A port available now may become unavailable by the time we start
|
||||
the desired service.
|
||||
|
||||
Note: this is not an instance method. As it's not exported it should be
|
||||
called from outside the module as C<PostgresNode::get_free_port()>.
|
||||
called from outside the module as C<PostgreSQL::Test::Cluster::get_free_port()>.
|
||||
|
||||
=cut
|
||||
|
||||
@ -1440,7 +1440,7 @@ sub get_free_port
|
||||
if ($found == 1)
|
||||
{
|
||||
foreach my $addr (qw(127.0.0.1),
|
||||
($use_tcp && $TestLib::windows_os)
|
||||
($use_tcp && $PostgreSQL::Test::Utils::windows_os)
|
||||
? qw(127.0.0.2 127.0.0.3 0.0.0.0)
|
||||
: ())
|
||||
{
|
||||
@ -1474,7 +1474,7 @@ sub can_bind
|
||||
|
||||
# As in postmaster, don't use SO_REUSEADDR on Windows
|
||||
setsockopt(SOCK, SOL_SOCKET, SO_REUSEADDR, pack("l", 1))
|
||||
unless $TestLib::windows_os;
|
||||
unless $PostgreSQL::Test::Utils::windows_os;
|
||||
my $ret = bind(SOCK, $paddr) && listen(SOCK, SOMAXCONN);
|
||||
close(SOCK);
|
||||
return $ret;
|
||||
@ -1496,7 +1496,7 @@ END
|
||||
next if defined $ENV{'PG_TEST_NOCLEAN'};
|
||||
|
||||
# clean basedir on clean test invocation
|
||||
$node->clean_node if $exit_code == 0 && TestLib::all_tests_passing();
|
||||
$node->clean_node if $exit_code == 0 && PostgreSQL::Test::Utils::all_tests_passing();
|
||||
}
|
||||
|
||||
$? = $exit_code;
|
||||
@ -2008,7 +2008,7 @@ sub _pgbench_make_files
|
||||
ok(0, "$filename must not already exist");
|
||||
unlink $filename or die "cannot unlink $filename: $!";
|
||||
}
|
||||
TestLib::append_to_file($filename, $$files{$fn});
|
||||
PostgreSQL::Test::Utils::append_to_file($filename, $$files{$fn});
|
||||
}
|
||||
}
|
||||
|
||||
@ -2194,7 +2194,7 @@ sub connect_ok
|
||||
}
|
||||
if (@log_like or @log_unlike)
|
||||
{
|
||||
my $log_contents = TestLib::slurp_file($self->logfile, $log_location);
|
||||
my $log_contents = PostgreSQL::Test::Utils::slurp_file($self->logfile, $log_location);
|
||||
|
||||
while (my $regex = shift @log_like)
|
||||
{
|
||||
@ -2264,7 +2264,7 @@ sub connect_fails
|
||||
|
||||
if (@log_like or @log_unlike)
|
||||
{
|
||||
my $log_contents = TestLib::slurp_file($self->logfile, $log_location);
|
||||
my $log_contents = PostgreSQL::Test::Utils::slurp_file($self->logfile, $log_location);
|
||||
|
||||
while (my $regex = shift @log_like)
|
||||
{
|
||||
@ -2343,8 +2343,8 @@ $stderr);
|
||||
|
||||
=item $node->command_ok(...)
|
||||
|
||||
Runs a shell command like TestLib::command_ok, but with PGHOST and PGPORT set
|
||||
so that the command will default to connecting to this PostgresNode.
|
||||
Runs a shell command like PostgreSQL::Test::Utils::command_ok, but with PGHOST and PGPORT set
|
||||
so that the command will default to connecting to this PostgreSQL::Test::Cluster.
|
||||
|
||||
=cut
|
||||
|
||||
@ -2356,7 +2356,7 @@ sub command_ok
|
||||
|
||||
local %ENV = $self->_get_env();
|
||||
|
||||
TestLib::command_ok(@_);
|
||||
PostgreSQL::Test::Utils::command_ok(@_);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2364,7 +2364,7 @@ sub command_ok
|
||||
|
||||
=item $node->command_fails(...)
|
||||
|
||||
TestLib::command_fails with our connection parameters. See command_ok(...)
|
||||
PostgreSQL::Test::Utils::command_fails with our connection parameters. See command_ok(...)
|
||||
|
||||
=cut
|
||||
|
||||
@ -2376,7 +2376,7 @@ sub command_fails
|
||||
|
||||
local %ENV = $self->_get_env();
|
||||
|
||||
TestLib::command_fails(@_);
|
||||
PostgreSQL::Test::Utils::command_fails(@_);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2384,7 +2384,7 @@ sub command_fails
|
||||
|
||||
=item $node->command_like(...)
|
||||
|
||||
TestLib::command_like with our connection parameters. See command_ok(...)
|
||||
PostgreSQL::Test::Utils::command_like with our connection parameters. See command_ok(...)
|
||||
|
||||
=cut
|
||||
|
||||
@ -2396,7 +2396,7 @@ sub command_like
|
||||
|
||||
local %ENV = $self->_get_env();
|
||||
|
||||
TestLib::command_like(@_);
|
||||
PostgreSQL::Test::Utils::command_like(@_);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2404,7 +2404,7 @@ sub command_like
|
||||
|
||||
=item $node->command_fails_like(...)
|
||||
|
||||
TestLib::command_fails_like with our connection parameters. See command_ok(...)
|
||||
PostgreSQL::Test::Utils::command_fails_like with our connection parameters. See command_ok(...)
|
||||
|
||||
=cut
|
||||
|
||||
@ -2416,7 +2416,7 @@ sub command_fails_like
|
||||
|
||||
local %ENV = $self->_get_env();
|
||||
|
||||
TestLib::command_fails_like(@_);
|
||||
PostgreSQL::Test::Utils::command_fails_like(@_);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2424,7 +2424,7 @@ sub command_fails_like
|
||||
|
||||
=item $node->command_checks_all(...)
|
||||
|
||||
TestLib::command_checks_all with our connection parameters. See
|
||||
PostgreSQL::Test::Utils::command_checks_all with our connection parameters. See
|
||||
command_ok(...)
|
||||
|
||||
=cut
|
||||
@ -2437,7 +2437,7 @@ sub command_checks_all
|
||||
|
||||
local %ENV = $self->_get_env();
|
||||
|
||||
TestLib::command_checks_all(@_);
|
||||
PostgreSQL::Test::Utils::command_checks_all(@_);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2460,9 +2460,9 @@ sub issues_sql_like
|
||||
|
||||
my $log_location = -s $self->logfile;
|
||||
|
||||
my $result = TestLib::run_log($cmd);
|
||||
my $result = PostgreSQL::Test::Utils::run_log($cmd);
|
||||
ok($result, "@$cmd exit code 0");
|
||||
my $log = TestLib::slurp_file($self->logfile, $log_location);
|
||||
my $log = PostgreSQL::Test::Utils::slurp_file($self->logfile, $log_location);
|
||||
like($log, $expected_sql, "$test_name: SQL found in server log");
|
||||
return;
|
||||
}
|
||||
@ -2471,8 +2471,8 @@ sub issues_sql_like
|
||||
|
||||
=item $node->run_log(...)
|
||||
|
||||
Runs a shell command like TestLib::run_log, but with connection parameters set
|
||||
so that the command will default to connecting to this PostgresNode.
|
||||
Runs a shell command like PostgreSQL::Test::Utils::run_log, but with connection parameters set
|
||||
so that the command will default to connecting to this PostgreSQL::Test::Cluster.
|
||||
|
||||
=cut
|
||||
|
||||
@ -2482,7 +2482,7 @@ sub run_log
|
||||
|
||||
local %ENV = $self->_get_env();
|
||||
|
||||
TestLib::run_log(@_);
|
||||
PostgreSQL::Test::Utils::run_log(@_);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2563,8 +2563,8 @@ sub wait_for_catchup
|
||||
. join(', ', keys(%valid_modes))
|
||||
unless exists($valid_modes{$mode});
|
||||
|
||||
# Allow passing of a PostgresNode instance as shorthand
|
||||
if (blessed($standby_name) && $standby_name->isa("PostgresNode"))
|
||||
# Allow passing of a PostgreSQL::Test::Cluster instance as shorthand
|
||||
if (blessed($standby_name) && $standby_name->isa("PostgreSQL::Test::Cluster"))
|
||||
{
|
||||
$standby_name = $standby_name->name;
|
||||
}
|
@ -5,18 +5,18 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
RecursiveCopy - simple recursive copy implementation
|
||||
PostgreSQL::Test::RecursiveCopy - simple recursive copy implementation
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use RecursiveCopy;
|
||||
use PostgreSQL::Test::RecursiveCopy;
|
||||
|
||||
RecursiveCopy::copypath($from, $to, filterfn => sub { return 1; });
|
||||
RecursiveCopy::copypath($from, $to);
|
||||
PostgreSQL::Test::RecursiveCopy::copypath($from, $to, filterfn => sub { return 1; });
|
||||
PostgreSQL::Test::RecursiveCopy::copypath($from, $to);
|
||||
|
||||
=cut
|
||||
|
||||
package RecursiveCopy;
|
||||
package PostgreSQL::Test::RecursiveCopy;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
@ -54,7 +54,7 @@ attempted.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
RecursiveCopy::copypath('/some/path', '/empty/dir',
|
||||
PostgreSQL::Test::RecursiveCopy::copypath('/some/path', '/empty/dir',
|
||||
filterfn => sub {
|
||||
# omit log/ and contents
|
||||
my $src = shift;
|
@ -10,7 +10,7 @@
|
||||
# method is currently implemented; that's all we need. We don't want to
|
||||
# depend on IO::Tee just for this.
|
||||
|
||||
package SimpleTee;
|
||||
package PostgreSQL::Test::SimpleTee;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -5,11 +5,11 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
TestLib - helper module for writing PostgreSQL's C<prove> tests.
|
||||
PostgreSQL::Test::Utils - helper module for writing PostgreSQL's C<prove> tests.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Utils;
|
||||
|
||||
# Test basic output of a command
|
||||
program_help_ok('initdb');
|
||||
@ -19,19 +19,19 @@ TestLib - helper module for writing PostgreSQL's C<prove> tests.
|
||||
# Test option combinations
|
||||
command_fails(['initdb', '--invalid-option'],
|
||||
'command fails with invalid option');
|
||||
my $tempdir = TestLib::tempdir;
|
||||
my $tempdir = PostgreSQL::Test::Utils::tempdir;
|
||||
command_ok('initdb', '-D', $tempdir);
|
||||
|
||||
# Miscellanea
|
||||
print "on Windows" if $TestLib::windows_os;
|
||||
my $path = TestLib::perl2host($backup_dir);
|
||||
print "on Windows" if $PostgreSQL::Test::Utils::windows_os;
|
||||
my $path = PostgreSQL::Test::Utils::perl2host($backup_dir);
|
||||
ok(check_mode_recursive($stream_dir, 0700, 0600),
|
||||
"check stream dir permissions");
|
||||
TestLib::system_log('pg_ctl', 'kill', 'QUIT', $slow_pid);
|
||||
PostgreSQL::Test::Utils::system_log('pg_ctl', 'kill', 'QUIT', $slow_pid);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
C<TestLib> contains a set of routines dedicated to environment setup for
|
||||
C<PostgreSQL::Test::Utils> contains a set of routines dedicated to environment setup for
|
||||
a PostgreSQL regression test run and includes some low-level routines
|
||||
aimed at controlling command execution, logging and test functions.
|
||||
|
||||
@ -40,7 +40,7 @@ aimed at controlling command execution, logging and test functions.
|
||||
# This module should never depend on any other PostgreSQL regression test
|
||||
# modules.
|
||||
|
||||
package TestLib;
|
||||
package PostgreSQL::Test::Utils;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
@ -56,7 +56,7 @@ use File::Spec;
|
||||
use File::stat qw(stat);
|
||||
use File::Temp ();
|
||||
use IPC::Run;
|
||||
use SimpleTee;
|
||||
use PostgreSQL::Test::SimpleTee;
|
||||
|
||||
# specify a recent enough version of Test::More to support the
|
||||
# done_testing() function
|
||||
@ -212,9 +212,9 @@ INIT
|
||||
# in the log.
|
||||
my $builder = Test::More->builder;
|
||||
my $fh = $builder->output;
|
||||
tie *$fh, "SimpleTee", $orig_stdout, $testlog;
|
||||
tie *$fh, "PostgreSQL::Test::SimpleTee", $orig_stdout, $testlog;
|
||||
$fh = $builder->failure_output;
|
||||
tie *$fh, "SimpleTee", $orig_stderr, $testlog;
|
||||
tie *$fh, "PostgreSQL::Test::SimpleTee", $orig_stderr, $testlog;
|
||||
|
||||
# Enable auto-flushing for all the file handles. Stderr and stdout are
|
||||
# redirected to the same file, and buffering causes the lines to appear
|
@ -1,6 +1,6 @@
|
||||
############################################################################
|
||||
#
|
||||
# PostgresVersion.pm
|
||||
# PostgreSQL/Version.pm
|
||||
#
|
||||
# Module encapsulating Postgres Version numbers
|
||||
#
|
||||
@ -12,13 +12,13 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
PostgresVersion - class representing PostgreSQL version numbers
|
||||
PostgreSQL::Version - class representing PostgreSQL version numbers
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use PostgresVersion;
|
||||
use PostgreSQL::Version;
|
||||
|
||||
my $version = PostgresVersion->new($version_arg);
|
||||
my $version = PostgreSQL::Version->new($version_arg);
|
||||
|
||||
# compare two versions
|
||||
my $bool = $version1 <= $version2;
|
||||
@ -37,12 +37,12 @@ PostgresVersion - class representing PostgreSQL version numbers
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
PostgresVersion encapsulates Postgres version numbers, providing parsing
|
||||
PostgreSQL::Version encapsulates Postgres version numbers, providing parsing
|
||||
of common version formats and comparison operations.
|
||||
|
||||
=cut
|
||||
|
||||
package PostgresVersion;
|
||||
package PostgreSQL::Version;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
@ -60,9 +60,9 @@ use overload
|
||||
|
||||
=over
|
||||
|
||||
=item PostgresVersion->new($version)
|
||||
=item PostgreSQL::Version->new($version)
|
||||
|
||||
Create a new PostgresVersion instance.
|
||||
Create a new PostgreSQL::Version instance.
|
||||
|
||||
The argument can be a number like 12, or a string like '12.2' or the output
|
||||
of a Postgres command like `psql --version` or `pg_config --version`;
|
||||
@ -103,7 +103,7 @@ sub new
|
||||
|
||||
# Routine which compares the _pg_version_array obtained for the two
|
||||
# arguments and returns -1, 0, or 1, allowing comparison between two
|
||||
# PostgresVersion objects or a PostgresVersion and a version string or number.
|
||||
# PostgreSQL::Version objects or a PostgreSQL::Version and a version string or number.
|
||||
#
|
||||
# If the second argument is not a blessed object we call the constructor
|
||||
# to make one.
|
@ -40,15 +40,15 @@ Each test script should begin with:
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
# Replace with the number of tests to execute:
|
||||
use Test::More tests => 1;
|
||||
|
||||
then it will generally need to set up one or more nodes, run commands
|
||||
against them and evaluate the results. For example:
|
||||
|
||||
my $node = PostgresNode->new('primary');
|
||||
my $node = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node->init;
|
||||
$node->start;
|
||||
|
||||
@ -76,7 +76,7 @@ Read the documentation for more on how to write tests:
|
||||
For available PostgreSQL-specific test methods and some example tests read the
|
||||
perldoc for the test modules, e.g.:
|
||||
|
||||
perldoc src/test/perl/PostgresNode.pm
|
||||
perldoc src/test/perl/PostgreSQL/Test/Cluster.pm
|
||||
|
||||
Portability
|
||||
-----------
|
||||
|
@ -4,12 +4,12 @@
|
||||
# Minimal test testing streaming replication
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 49;
|
||||
|
||||
# Initialize primary node
|
||||
my $node_primary = PostgresNode->new('primary');
|
||||
my $node_primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
# A specific role is created to perform some tests related to replication,
|
||||
# and it needs proper authentication configuration.
|
||||
$node_primary->init(
|
||||
@ -22,7 +22,7 @@ my $backup_name = 'my_backup';
|
||||
$node_primary->backup($backup_name);
|
||||
|
||||
# Create streaming standby linking to primary
|
||||
my $node_standby_1 = PostgresNode->new('standby_1');
|
||||
my $node_standby_1 = PostgreSQL::Test::Cluster->new('standby_1');
|
||||
$node_standby_1->init_from_backup($node_primary, $backup_name,
|
||||
has_streaming => 1);
|
||||
$node_standby_1->start;
|
||||
@ -37,7 +37,7 @@ $node_standby_1->backup('my_backup_2');
|
||||
$node_primary->start;
|
||||
|
||||
# Create second standby node linking to standby 1
|
||||
my $node_standby_2 = PostgresNode->new('standby_2');
|
||||
my $node_standby_2 = PostgreSQL::Test::Cluster->new('standby_2');
|
||||
$node_standby_2->init_from_backup($node_standby_1, $backup_name,
|
||||
has_streaming => 1);
|
||||
$node_standby_2->start;
|
||||
|
@ -4,13 +4,13 @@
|
||||
# test for archiving with hot standby
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 3;
|
||||
use File::Copy;
|
||||
|
||||
# Initialize primary node, doing archives
|
||||
my $node_primary = PostgresNode->new('primary');
|
||||
my $node_primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node_primary->init(
|
||||
has_archiving => 1,
|
||||
allows_streaming => 1);
|
||||
@ -23,7 +23,7 @@ $node_primary->start;
|
||||
$node_primary->backup($backup_name);
|
||||
|
||||
# Initialize standby node from backup, fetching WAL from archives
|
||||
my $node_standby = PostgresNode->new('standby');
|
||||
my $node_standby = PostgreSQL::Test::Cluster->new('standby');
|
||||
$node_standby->init_from_backup($node_primary, $backup_name,
|
||||
has_restoring => 1);
|
||||
$node_standby->append_conf('postgresql.conf',
|
||||
@ -62,7 +62,7 @@ is($result, qq(1000), 'check content from archives');
|
||||
# promoted.
|
||||
$node_standby->promote;
|
||||
|
||||
my $node_standby2 = PostgresNode->new('standby2');
|
||||
my $node_standby2 = PostgreSQL::Test::Cluster->new('standby2');
|
||||
$node_standby2->init_from_backup($node_primary, $backup_name,
|
||||
has_restoring => 1);
|
||||
$node_standby2->start;
|
||||
|
@ -4,8 +4,8 @@
|
||||
# Test for recovery targets: name, timestamp, XID
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 9;
|
||||
use Time::HiRes qw(usleep);
|
||||
|
||||
@ -23,7 +23,7 @@ sub test_recovery_standby
|
||||
my $num_rows = shift;
|
||||
my $until_lsn = shift;
|
||||
|
||||
my $node_standby = PostgresNode->new($node_name);
|
||||
my $node_standby = PostgreSQL::Test::Cluster->new($node_name);
|
||||
$node_standby->init_from_backup($node_primary, 'my_backup',
|
||||
has_restoring => 1);
|
||||
|
||||
@ -52,7 +52,7 @@ sub test_recovery_standby
|
||||
}
|
||||
|
||||
# Initialize primary node
|
||||
my $node_primary = PostgresNode->new('primary');
|
||||
my $node_primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node_primary->init(has_archiving => 1, allows_streaming => 1);
|
||||
|
||||
# Bump the transaction ID epoch. This is useful to stress the portability
|
||||
@ -138,7 +138,7 @@ test_recovery_standby('LSN', 'standby_5', $node_primary, \@recovery_params,
|
||||
test_recovery_standby('multiple overriding settings',
|
||||
'standby_6', $node_primary, \@recovery_params, "3000", $lsn3);
|
||||
|
||||
my $node_standby = PostgresNode->new('standby_7');
|
||||
my $node_standby = PostgreSQL::Test::Cluster->new('standby_7');
|
||||
$node_standby->init_from_backup($node_primary, 'my_backup',
|
||||
has_restoring => 1);
|
||||
$node_standby->append_conf(
|
||||
@ -158,7 +158,7 @@ ok($logfile =~ qr/multiple recovery targets specified/,
|
||||
|
||||
# Check behavior when recovery ends before target is reached
|
||||
|
||||
$node_standby = PostgresNode->new('standby_8');
|
||||
$node_standby = PostgreSQL::Test::Cluster->new('standby_8');
|
||||
$node_standby->init_from_backup(
|
||||
$node_primary, 'my_backup',
|
||||
has_restoring => 1,
|
||||
|
@ -5,8 +5,8 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use File::Path qw(rmtree);
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 3;
|
||||
|
||||
$ENV{PGDATABASE} = 'postgres';
|
||||
@ -15,7 +15,7 @@ $ENV{PGDATABASE} = 'postgres';
|
||||
# on a new timeline.
|
||||
|
||||
# Initialize primary node
|
||||
my $node_primary = PostgresNode->new('primary');
|
||||
my $node_primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node_primary->init(allows_streaming => 1);
|
||||
$node_primary->start;
|
||||
|
||||
@ -24,11 +24,11 @@ my $backup_name = 'my_backup';
|
||||
$node_primary->backup($backup_name);
|
||||
|
||||
# Create two standbys linking to it
|
||||
my $node_standby_1 = PostgresNode->new('standby_1');
|
||||
my $node_standby_1 = PostgreSQL::Test::Cluster->new('standby_1');
|
||||
$node_standby_1->init_from_backup($node_primary, $backup_name,
|
||||
has_streaming => 1);
|
||||
$node_standby_1->start;
|
||||
my $node_standby_2 = PostgresNode->new('standby_2');
|
||||
my $node_standby_2 = PostgreSQL::Test::Cluster->new('standby_2');
|
||||
$node_standby_2->init_from_backup($node_primary, $backup_name,
|
||||
has_streaming => 1);
|
||||
$node_standby_2->start;
|
||||
@ -76,7 +76,7 @@ is($result, qq(2000), 'check content of standby 2');
|
||||
# when WAL archiving is enabled.
|
||||
|
||||
# Initialize primary node
|
||||
my $node_primary_2 = PostgresNode->new('primary_2');
|
||||
my $node_primary_2 = PostgreSQL::Test::Cluster->new('primary_2');
|
||||
$node_primary_2->init(allows_streaming => 1, has_archiving => 1);
|
||||
$node_primary_2->append_conf(
|
||||
'postgresql.conf', qq(
|
||||
@ -88,7 +88,7 @@ $node_primary_2->start;
|
||||
$node_primary_2->backup($backup_name);
|
||||
|
||||
# Create standby node
|
||||
my $node_standby_3 = PostgresNode->new('standby_3');
|
||||
my $node_standby_3 = PostgreSQL::Test::Cluster->new('standby_3');
|
||||
$node_standby_3->init_from_backup($node_primary_2, $backup_name,
|
||||
has_streaming => 1);
|
||||
|
||||
|
@ -5,12 +5,12 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 3;
|
||||
|
||||
# Initialize primary node
|
||||
my $node_primary = PostgresNode->new('primary');
|
||||
my $node_primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node_primary->init(allows_streaming => 1);
|
||||
$node_primary->start;
|
||||
|
||||
@ -23,7 +23,7 @@ my $backup_name = 'my_backup';
|
||||
$node_primary->backup($backup_name);
|
||||
|
||||
# Create streaming standby from backup
|
||||
my $node_standby = PostgresNode->new('standby');
|
||||
my $node_standby = PostgreSQL::Test::Cluster->new('standby');
|
||||
my $delay = 3;
|
||||
$node_standby->init_from_backup($node_primary, $backup_name,
|
||||
has_streaming => 1);
|
||||
@ -58,7 +58,7 @@ ok(time() - $primary_insert_time >= $delay,
|
||||
|
||||
|
||||
# Check that recovery can be paused or resumed expectedly.
|
||||
my $node_standby2 = PostgresNode->new('standby2');
|
||||
my $node_standby2 = PostgreSQL::Test::Cluster->new('standby2');
|
||||
$node_standby2->init_from_backup($node_primary, $backup_name,
|
||||
has_streaming => 1);
|
||||
$node_standby2->start;
|
||||
|
@ -8,13 +8,13 @@
|
||||
# are required.
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 14;
|
||||
use Config;
|
||||
|
||||
# Initialize primary node
|
||||
my $node_primary = PostgresNode->new('primary');
|
||||
my $node_primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node_primary->init(allows_streaming => 1);
|
||||
$node_primary->append_conf(
|
||||
'postgresql.conf', qq(
|
||||
|
@ -4,8 +4,8 @@
|
||||
# Minimal test testing synchronous replication sync_state transition
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 11;
|
||||
|
||||
# Query checking sync_priority and sync_state of each standby
|
||||
@ -51,7 +51,7 @@ sub start_standby_and_wait
|
||||
}
|
||||
|
||||
# Initialize primary node
|
||||
my $node_primary = PostgresNode->new('primary');
|
||||
my $node_primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node_primary->init(allows_streaming => 1);
|
||||
$node_primary->start;
|
||||
my $backup_name = 'primary_backup';
|
||||
@ -63,19 +63,19 @@ $node_primary->backup($backup_name);
|
||||
# the ordering of each one of them in the WAL sender array of the primary.
|
||||
|
||||
# Create standby1 linking to primary
|
||||
my $node_standby_1 = PostgresNode->new('standby1');
|
||||
my $node_standby_1 = PostgreSQL::Test::Cluster->new('standby1');
|
||||
$node_standby_1->init_from_backup($node_primary, $backup_name,
|
||||
has_streaming => 1);
|
||||
start_standby_and_wait($node_primary, $node_standby_1);
|
||||
|
||||
# Create standby2 linking to primary
|
||||
my $node_standby_2 = PostgresNode->new('standby2');
|
||||
my $node_standby_2 = PostgreSQL::Test::Cluster->new('standby2');
|
||||
$node_standby_2->init_from_backup($node_primary, $backup_name,
|
||||
has_streaming => 1);
|
||||
start_standby_and_wait($node_primary, $node_standby_2);
|
||||
|
||||
# Create standby3 linking to primary
|
||||
my $node_standby_3 = PostgresNode->new('standby3');
|
||||
my $node_standby_3 = PostgreSQL::Test::Cluster->new('standby3');
|
||||
$node_standby_3->init_from_backup($node_primary, $backup_name,
|
||||
has_streaming => 1);
|
||||
start_standby_and_wait($node_primary, $node_standby_3);
|
||||
@ -125,7 +125,7 @@ standby3|3|sync),
|
||||
start_standby_and_wait($node_primary, $node_standby_1);
|
||||
|
||||
# Create standby4 linking to primary
|
||||
my $node_standby_4 = PostgresNode->new('standby4');
|
||||
my $node_standby_4 = PostgreSQL::Test::Cluster->new('standby4');
|
||||
$node_standby_4->init_from_backup($node_primary, $backup_name,
|
||||
has_streaming => 1);
|
||||
$node_standby_4->start;
|
||||
|
@ -8,11 +8,11 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 1;
|
||||
|
||||
my $node_primary = PostgresNode->new('primary');
|
||||
my $node_primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node_primary->init(allows_streaming => 1);
|
||||
|
||||
$node_primary->append_conf(
|
||||
@ -28,7 +28,7 @@ autovacuum = off
|
||||
$node_primary->start;
|
||||
|
||||
$node_primary->backup('primary_backup');
|
||||
my $node_standby = PostgresNode->new('standby');
|
||||
my $node_standby = PostgreSQL::Test::Cluster->new('standby');
|
||||
$node_standby->init_from_backup($node_primary, 'primary_backup',
|
||||
has_streaming => 1);
|
||||
$node_standby->start;
|
||||
|
@ -5,8 +5,8 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 24;
|
||||
|
||||
my $psql_out = '';
|
||||
@ -31,7 +31,7 @@ sub configure_and_reload
|
||||
# Set up two nodes, which will alternately be primary and replication standby.
|
||||
|
||||
# Setup london node
|
||||
my $node_london = PostgresNode->new("london");
|
||||
my $node_london = PostgreSQL::Test::Cluster->new("london");
|
||||
$node_london->init(allows_streaming => 1);
|
||||
$node_london->append_conf(
|
||||
'postgresql.conf', qq(
|
||||
@ -42,7 +42,7 @@ $node_london->start;
|
||||
$node_london->backup('london_backup');
|
||||
|
||||
# Setup paris node
|
||||
my $node_paris = PostgresNode->new('paris');
|
||||
my $node_paris = PostgreSQL::Test::Cluster->new('paris');
|
||||
$node_paris->init_from_backup($node_london, 'london_backup',
|
||||
has_streaming => 1);
|
||||
$node_paris->start;
|
||||
|
@ -24,8 +24,8 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More tests => 13;
|
||||
use File::Copy;
|
||||
use IPC::Run ();
|
||||
@ -34,7 +34,7 @@ use Scalar::Util qw(blessed);
|
||||
my ($stdout, $stderr, $ret);
|
||||
|
||||
# Initialize primary node
|
||||
my $node_primary = PostgresNode->new('primary');
|
||||
my $node_primary = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node_primary->init(allows_streaming => 1, has_archiving => 1);
|
||||
$node_primary->append_conf(
|
||||
'postgresql.conf', q[
|
||||
@ -74,7 +74,7 @@ $node_primary->backup_fs_hot($backup_name);
|
||||
$node_primary->safe_psql('postgres',
|
||||
q[SELECT pg_create_physical_replication_slot('phys_slot');]);
|
||||
|
||||
my $node_replica = PostgresNode->new('replica');
|
||||
my $node_replica = PostgreSQL::Test::Cluster->new('replica');
|
||||
$node_replica->init_from_backup(
|
||||
$node_primary, $backup_name,
|
||||
has_streaming => 1,
|
||||
|
@ -6,14 +6,14 @@
|
||||
#
|
||||
use strict;
|
||||
use warnings;
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use PostgreSQL::Test::Cluster;
|
||||
use PostgreSQL::Test::Utils;
|
||||
use Test::More;
|
||||
use Config;
|
||||
|
||||
plan tests => 3;
|
||||
|
||||
my $node = PostgresNode->new('primary');
|
||||
my $node = PostgreSQL::Test::Cluster->new('primary');
|
||||
$node->init(allows_streaming => 1);
|
||||
$node->start;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user