diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2021-10-24 10:28:19 -0400 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2021-10-24 10:28:19 -0400 |
commit | b3b4d8e68ae83f432f43f035c7eb481ef93e1583 (patch) | |
tree | ff4e73500b61f2235bd4e3822d8e1a1af3a37523 /src/bin | |
parent | 3cd9c3b921977272e6650a5efbeade4203c4bca2 (diff) | |
download | postgresql-b3b4d8e68ae83f432f43f035c7eb481ef93e1583.tar.gz |
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
Diffstat (limited to 'src/bin')
61 files changed, 199 insertions, 199 deletions
diff --git a/src/bin/initdb/t/001_initdb.pl b/src/bin/initdb/t/001_initdb.pl index 635ff79b47..6796d8520e 100644 --- a/src/bin/initdb/t/001_initdb.pl +++ b/src/bin/initdb/t/001_initdb.pl @@ -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"; diff --git a/src/bin/pg_amcheck/t/001_basic.pl b/src/bin/pg_amcheck/t/001_basic.pl index 6f60e3ec1f..d44fe60a4c 100644 --- a/src/bin/pg_amcheck/t/001_basic.pl +++ b/src/bin/pg_amcheck/t/001_basic.pl @@ -4,7 +4,7 @@ use strict; use warnings; -use TestLib; +use PostgreSQL::Test::Utils; use Test::More tests => 8; program_help_ok('pg_amcheck'); diff --git a/src/bin/pg_amcheck/t/002_nonesuch.pl b/src/bin/pg_amcheck/t/002_nonesuch.pl index e30c1cc546..513a18d671 100644 --- a/src/bin/pg_amcheck/t/002_nonesuch.pl +++ b/src/bin/pg_amcheck/t/002_nonesuch.pl @@ -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; diff --git a/src/bin/pg_amcheck/t/003_check.pl b/src/bin/pg_amcheck/t/003_check.pl index c26e5eda67..5913fcc530 100644 --- a/src/bin/pg_amcheck/t/003_check.pl +++ b/src/bin/pg_amcheck/t/003_check.pl @@ -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 diff --git a/src/bin/pg_amcheck/t/004_verify_heapam.pl b/src/bin/pg_amcheck/t/004_verify_heapam.pl index a9f485e527..4ca7ed297c 100644 --- a/src/bin/pg_amcheck/t/004_verify_heapam.pl +++ b/src/bin/pg_amcheck/t/004_verify_heapam.pl @@ -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'); diff --git a/src/bin/pg_amcheck/t/005_opclass_damage.pl b/src/bin/pg_amcheck/t/005_opclass_damage.pl index e87d81d7d4..2f86f4f2a4 100644 --- a/src/bin/pg_amcheck/t/005_opclass_damage.pl +++ b/src/bin/pg_amcheck/t/005_opclass_damage.pl @@ -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; diff --git a/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl b/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl index 8d689b9601..6b3f486cfa 100644 --- a/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl +++ b/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl @@ -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', diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl index a2cb2a7679..89f45b77a3 100644 --- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl +++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl @@ -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. diff --git a/src/bin/pg_basebackup/t/020_pg_receivewal.pl b/src/bin/pg_basebackup/t/020_pg_receivewal.pl index 0b33d73900..b93493b5e9 100644 --- a/src/bin/pg_basebackup/t/020_pg_receivewal.pl +++ b/src/bin/pg_basebackup/t/020_pg_receivewal.pl @@ -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; diff --git a/src/bin/pg_basebackup/t/030_pg_recvlogical.pl b/src/bin/pg_basebackup/t/030_pg_recvlogical.pl index fe7fe76295..90da1662e3 100644 --- a/src/bin/pg_basebackup/t/030_pg_recvlogical.pl +++ b/src/bin/pg_basebackup/t/030_pg_recvlogical.pl @@ -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); diff --git a/src/bin/pg_checksums/t/001_basic.pl b/src/bin/pg_checksums/t/001_basic.pl index 62e78a5043..e9eb3197a6 100644 --- a/src/bin/pg_checksums/t/001_basic.pl +++ b/src/bin/pg_checksums/t/001_basic.pl @@ -3,7 +3,7 @@ use strict; use warnings; -use TestLib; +use PostgreSQL::Test::Utils; use Test::More tests => 8; program_help_ok('pg_checksums'); diff --git a/src/bin/pg_checksums/t/002_actions.pl b/src/bin/pg_checksums/t/002_actions.pl index 0b3e19ab7c..20a5f27840 100644 --- a/src/bin/pg_checksums/t/002_actions.pl +++ b/src/bin/pg_checksums/t/002_actions.pl @@ -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'); diff --git a/src/bin/pg_config/t/001_pg_config.pl b/src/bin/pg_config/t/001_pg_config.pl index d8829faea6..6c7f9b8602 100644 --- a/src/bin/pg_config/t/001_pg_config.pl +++ b/src/bin/pg_config/t/001_pg_config.pl @@ -3,7 +3,7 @@ use strict; use warnings; -use TestLib; +use PostgreSQL::Test::Utils; use Test::More tests => 20; program_help_ok('pg_config'); diff --git a/src/bin/pg_controldata/t/001_pg_controldata.pl b/src/bin/pg_controldata/t/001_pg_controldata.pl index ce31cfbd3b..ad7bacace5 100644 --- a/src/bin/pg_controldata/t/001_pg_controldata.pl +++ b/src/bin/pg_controldata/t/001_pg_controldata.pl @@ -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 ], diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl index 1d8d6bbb70..f95352bf94 100644 --- a/src/bin/pg_ctl/t/001_start_stop.pl +++ b/src/bin/pg_ctl/t/001_start_stop.pl @@ -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') { diff --git a/src/bin/pg_ctl/t/002_status.pl b/src/bin/pg_ctl/t/002_status.pl index c6f4fac57b..a74e6e3b91 100644 --- a/src/bin/pg_ctl/t/002_status.pl +++ b/src/bin/pg_ctl/t/002_status.pl @@ -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 ], diff --git a/src/bin/pg_ctl/t/003_promote.pl b/src/bin/pg_ctl/t/003_promote.pl index 547b3d8893..50819db92b 100644 --- a/src/bin/pg_ctl/t/003_promote.pl +++ b/src/bin/pg_ctl/t/003_promote.pl @@ -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; diff --git a/src/bin/pg_ctl/t/004_logrotate.pl b/src/bin/pg_ctl/t/004_logrotate.pl index 13e91f3bc9..3813a3b1fd 100644 --- a/src/bin/pg_ctl/t/004_logrotate.pl +++ b/src/bin/pg_ctl/t/004_logrotate.pl @@ -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( diff --git a/src/bin/pg_dump/t/001_basic.pl b/src/bin/pg_dump/t/001_basic.pl index d6731855ed..863f4da3d8 100644 --- a/src/bin/pg_dump/t/001_basic.pl +++ b/src/bin/pg_dump/t/001_basic.pl @@ -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 diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index 7e00f4ddbb..2eece79250 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -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; diff --git a/src/bin/pg_dump/t/003_pg_dump_with_server.pl b/src/bin/pg_dump/t/003_pg_dump_with_server.pl index a879ae28d8..66d9563d86 100644 --- a/src/bin/pg_dump/t/003_pg_dump_with_server.pl +++ b/src/bin/pg_dump/t/003_pg_dump_with_server.pl @@ -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; diff --git a/src/bin/pg_dump/t/010_dump_connstr.pl b/src/bin/pg_dump/t/010_dump_connstr.pl index c4b60c5d2a..b36e2a42af 100644 --- a/src/bin/pg_dump/t/010_dump_connstr.pl +++ b/src/bin/pg_dump/t/010_dump_connstr.pl @@ -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' ], diff --git a/src/bin/pg_resetwal/t/001_basic.pl b/src/bin/pg_resetwal/t/001_basic.pl index f01a4d2d48..0f86aea68e 100644 --- a/src/bin/pg_resetwal/t/001_basic.pl +++ b/src/bin/pg_resetwal/t/001_basic.pl @@ -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 ], diff --git a/src/bin/pg_resetwal/t/002_corrupted.pl b/src/bin/pg_resetwal/t/002_corrupted.pl index ac915ef91f..fd0c3ecb23 100644 --- a/src/bin/pg_resetwal/t/002_corrupted.pl +++ b/src/bin/pg_resetwal/t/002_corrupted.pl @@ -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'; diff --git a/src/bin/pg_rewind/t/001_basic.pl b/src/bin/pg_rewind/t/001_basic.pl index d636f35f5e..7738c306d2 100644 --- a/src/bin/pg_rewind/t/001_basic.pl +++ b/src/bin/pg_rewind/t/001_basic.pl @@ -3,7 +3,7 @@ use strict; use warnings; -use TestLib; +use PostgreSQL::Test::Utils; use Test::More tests => 23; use FindBin; diff --git a/src/bin/pg_rewind/t/002_databases.pl b/src/bin/pg_rewind/t/002_databases.pl index 72c4b225a7..f3fba68fd6 100644 --- a/src/bin/pg_rewind/t/002_databases.pl +++ b/src/bin/pg_rewind/t/002_databases.pl @@ -3,7 +3,7 @@ use strict; use warnings; -use TestLib; +use PostgreSQL::Test::Utils; use Test::More tests => 7; use FindBin; diff --git a/src/bin/pg_rewind/t/003_extrafiles.pl b/src/bin/pg_rewind/t/003_extrafiles.pl index 672c5e586b..c363b2b362 100644 --- a/src/bin/pg_rewind/t/003_extrafiles.pl +++ b/src/bin/pg_rewind/t/003_extrafiles.pl @@ -5,7 +5,7 @@ use strict; use warnings; -use TestLib; +use PostgreSQL::Test::Utils; use Test::More tests => 5; use File::Find; diff --git a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl index 8fb0ab3ead..92952173cb 100644 --- a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl +++ b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl @@ -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); diff --git a/src/bin/pg_rewind/t/005_same_timeline.pl b/src/bin/pg_rewind/t/005_same_timeline.pl index efe1d4c77f..85a2f20b11 100644 --- a/src/bin/pg_rewind/t/005_same_timeline.pl +++ b/src/bin/pg_rewind/t/005_same_timeline.pl @@ -7,7 +7,7 @@ # use strict; use warnings; -use TestLib; +use PostgreSQL::Test::Utils; use Test::More tests => 1; use FindBin; diff --git a/src/bin/pg_rewind/t/006_options.pl b/src/bin/pg_rewind/t/006_options.pl index 81793899e5..30c7bb46d2 100644 --- a/src/bin/pg_rewind/t/006_options.pl +++ b/src/bin/pg_rewind/t/006_options.pl @@ -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', diff --git a/src/bin/pg_rewind/t/007_standby_source.pl b/src/bin/pg_rewind/t/007_standby_source.pl index 2a717f5a2e..d23411bb5b 100644 --- a/src/bin/pg_rewind/t/007_standby_source.pl +++ b/src/bin/pg_rewind/t/007_standby_source.pl @@ -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; diff --git a/src/bin/pg_rewind/t/008_min_recovery_point.pl b/src/bin/pg_rewind/t/008_min_recovery_point.pl index 7a390f4abd..ad80cb3a08 100644 --- a/src/bin/pg_rewind/t/008_min_recovery_point.pl +++ b/src/bin/pg_rewind/t/008_min_recovery_point.pl @@ -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; diff --git a/src/bin/pg_rewind/t/RewindTest.pm b/src/bin/pg_rewind/t/RewindTest.pm index 367b99a438..5546ce456c 100644 --- a/src/bin/pg_rewind/t/RewindTest.pm +++ b/src/bin/pg_rewind/t/RewindTest.pm @@ -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 diff --git a/src/bin/pg_test_fsync/t/001_basic.pl b/src/bin/pg_test_fsync/t/001_basic.pl index c0d0effd92..8c71f1111e 100644 --- a/src/bin/pg_test_fsync/t/001_basic.pl +++ b/src/bin/pg_test_fsync/t/001_basic.pl @@ -5,7 +5,7 @@ use strict; use warnings; use Config; -use TestLib; +use PostgreSQL::Test::Utils; use Test::More tests => 12; ######################################### diff --git a/src/bin/pg_test_timing/t/001_basic.pl b/src/bin/pg_test_timing/t/001_basic.pl index 72e5a42b6f..3e58926c96 100644 --- a/src/bin/pg_test_timing/t/001_basic.pl +++ b/src/bin/pg_test_timing/t/001_basic.pl @@ -5,7 +5,7 @@ use strict; use warnings; use Config; -use TestLib; +use PostgreSQL::Test::Utils; use Test::More tests => 12; ######################################### diff --git a/src/bin/pg_verifybackup/t/001_basic.pl b/src/bin/pg_verifybackup/t/001_basic.pl index 4ad1c3f0a9..33d6b38d33 100644 --- a/src/bin/pg_verifybackup/t/001_basic.pl +++ b/src/bin/pg_verifybackup/t/001_basic.pl @@ -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'); diff --git a/src/bin/pg_verifybackup/t/002_algorithm.pl b/src/bin/pg_verifybackup/t/002_algorithm.pl index 7dc1af982a..5c429ea7fc 100644 --- a/src/bin/pg_verifybackup/t/002_algorithm.pl +++ b/src/bin/pg_verifybackup/t/002_algorithm.pl @@ -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; diff --git a/src/bin/pg_verifybackup/t/003_corruption.pl b/src/bin/pg_verifybackup/t/003_corruption.pl index 509390f975..7a8c5d7a04 100644 --- a/src/bin/pg_verifybackup/t/003_corruption.pl +++ b/src/bin/pg_verifybackup/t/003_corruption.pl @@ -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 diff --git a/src/bin/pg_verifybackup/t/004_options.pl b/src/bin/pg_verifybackup/t/004_options.pl index d4210fd293..22b1444091 100644 --- a/src/bin/pg_verifybackup/t/004_options.pl +++ b/src/bin/pg_verifybackup/t/004_options.pl @@ -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'; diff --git a/src/bin/pg_verifybackup/t/005_bad_manifest.pl b/src/bin/pg_verifybackup/t/005_bad_manifest.pl index 1420cfb352..c8ea12838c 100644 --- a/src/bin/pg_verifybackup/t/005_bad_manifest.pl +++ b/src/bin/pg_verifybackup/t/005_bad_manifest.pl @@ -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', diff --git a/src/bin/pg_verifybackup/t/006_encoding.pl b/src/bin/pg_verifybackup/t/006_encoding.pl index c0667b7f43..21c4198b1c 100644 --- a/src/bin/pg_verifybackup/t/006_encoding.pl +++ b/src/bin/pg_verifybackup/t/006_encoding.pl @@ -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'; diff --git a/src/bin/pg_verifybackup/t/007_wal.pl b/src/bin/pg_verifybackup/t/007_wal.pl index dc85b2a774..6eb245a9ef 100644 --- a/src/bin/pg_verifybackup/t/007_wal.pl +++ b/src/bin/pg_verifybackup/t/007_wal.pl @@ -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'; diff --git a/src/bin/pg_waldump/t/001_basic.pl b/src/bin/pg_waldump/t/001_basic.pl index fb2f807dc3..fdc968a5ee 100644 --- a/src/bin/pg_waldump/t/001_basic.pl +++ b/src/bin/pg_waldump/t/001_basic.pl @@ -3,7 +3,7 @@ use strict; use warnings; -use TestLib; +use PostgreSQL::Test::Utils; use Test::More tests => 8; program_help_ok('pg_waldump'); diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl index 7ca96e58ca..69ffa595dd 100644 --- a/src/bin/pgbench/t/001_pgbench_with_server.pl +++ b/src/bin/pgbench/t/001_pgbench_with_server.pl @@ -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\.\.\.'], diff --git a/src/bin/pgbench/t/002_pgbench_no_server.pl b/src/bin/pgbench/t/002_pgbench_no_server.pl index da38d9b1d2..703eff490b 100644 --- a/src/bin/pgbench/t/002_pgbench_no_server.pl +++ b/src/bin/pgbench/t/002_pgbench_no_server.pl @@ -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}\": $!"); diff --git a/src/bin/psql/t/001_basic.pl b/src/bin/psql/t/001_basic.pl index eb9041d1f3..6ca0bc75d0 100644 --- a/src/bin/psql/t/001_basic.pl +++ b/src/bin/psql/t/001_basic.pl @@ -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{ diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl index dbca56afad..55b318517e 100644 --- a/src/bin/psql/t/010_tab_completion.pl +++ b/src/bin/psql/t/010_tab_completion.pl @@ -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 diff --git a/src/bin/psql/t/020_cancel.pl b/src/bin/psql/t/020_cancel.pl index 0ca8e1743d..28d72caf2a 100644 --- a/src/bin/psql/t/020_cancel.pl +++ b/src/bin/psql/t/020_cancel.pl @@ -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) diff --git a/src/bin/scripts/t/010_clusterdb.pl b/src/bin/scripts/t/010_clusterdb.pl index aae5ea985b..0ba4aa4876 100644 --- a/src/bin/scripts/t/010_clusterdb.pl +++ b/src/bin/scripts/t/010_clusterdb.pl @@ -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; diff --git a/src/bin/scripts/t/011_clusterdb_all.pl b/src/bin/scripts/t/011_clusterdb_all.pl index 6ba71780de..d040b95cfb 100644 --- a/src/bin/scripts/t/011_clusterdb_all.pl +++ b/src/bin/scripts/t/011_clusterdb_all.pl @@ -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; diff --git a/src/bin/scripts/t/020_createdb.pl b/src/bin/scripts/t/020_createdb.pl index 3db2f13ae2..cb8e26c773 100644 --- a/src/bin/scripts/t/020_createdb.pl +++ b/src/bin/scripts/t/020_createdb.pl @@ -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; diff --git a/src/bin/scripts/t/040_createuser.pl b/src/bin/scripts/t/040_createuser.pl index 3da8b7ae75..a865c01f5a 100644 --- a/src/bin/scripts/t/040_createuser.pl +++ b/src/bin/scripts/t/040_createuser.pl @@ -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; diff --git a/src/bin/scripts/t/050_dropdb.pl b/src/bin/scripts/t/050_dropdb.pl index b9f0592bca..5c9342f290 100644 --- a/src/bin/scripts/t/050_dropdb.pl +++ b/src/bin/scripts/t/050_dropdb.pl @@ -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; diff --git a/src/bin/scripts/t/070_dropuser.pl b/src/bin/scripts/t/070_dropuser.pl index 26dadaf4a5..5d6e75c903 100644 --- a/src/bin/scripts/t/070_dropuser.pl +++ b/src/bin/scripts/t/070_dropuser.pl @@ -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; diff --git a/src/bin/scripts/t/080_pg_isready.pl b/src/bin/scripts/t/080_pg_isready.pl index 4f1184953e..42be32decc 100644 --- a/src/bin/scripts/t/080_pg_isready.pl +++ b/src/bin/scripts/t/080_pg_isready.pl @@ -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; diff --git a/src/bin/scripts/t/090_reindexdb.pl b/src/bin/scripts/t/090_reindexdb.pl index 541504d8f0..5384b74ccd 100644 --- a/src/bin/scripts/t/090_reindexdb.pl +++ b/src/bin/scripts/t/090_reindexdb.pl @@ -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';"); diff --git a/src/bin/scripts/t/091_reindexdb_all.pl b/src/bin/scripts/t/091_reindexdb_all.pl index 34174e4d71..acb2418976 100644 --- a/src/bin/scripts/t/091_reindexdb_all.pl +++ b/src/bin/scripts/t/091_reindexdb_all.pl @@ -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; diff --git a/src/bin/scripts/t/100_vacuumdb.pl b/src/bin/scripts/t/100_vacuumdb.pl index 0f1e5bb278..6937a35bc4 100644 --- a/src/bin/scripts/t/100_vacuumdb.pl +++ b/src/bin/scripts/t/100_vacuumdb.pl @@ -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; diff --git a/src/bin/scripts/t/101_vacuumdb_all.pl b/src/bin/scripts/t/101_vacuumdb_all.pl index a60fc79aae..3dfbfbfdb2 100644 --- a/src/bin/scripts/t/101_vacuumdb_all.pl +++ b/src/bin/scripts/t/101_vacuumdb_all.pl @@ -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; diff --git a/src/bin/scripts/t/102_vacuumdb_stages.pl b/src/bin/scripts/t/102_vacuumdb_stages.pl index c15057a763..f7bd45ba92 100644 --- a/src/bin/scripts/t/102_vacuumdb_stages.pl +++ b/src/bin/scripts/t/102_vacuumdb_stages.pl @@ -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; diff --git a/src/bin/scripts/t/200_connstr.pl b/src/bin/scripts/t/200_connstr.pl index f702e32f00..b2fa50a1c6 100644 --- a/src/bin/scripts/t/200_connstr.pl +++ b/src/bin/scripts/t/200_connstr.pl @@ -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; |