diff options
| author | Andrew Dunstan | 2021-10-24 14:28:19 +0000 |
|---|---|---|
| committer | Andrew Dunstan | 2021-10-24 14:28:19 +0000 |
| commit | b3b4d8e68ae83f432f43f035c7eb481ef93e1583 (patch) | |
| tree | ff4e73500b61f2235bd4e3822d8e1a1af3a37523 /src/test/modules | |
| parent | 3cd9c3b921977272e6650a5efbeade4203c4bca2 (diff) | |
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/test/modules')
| -rw-r--r-- | src/test/modules/brin/t/01_workitems.pl | 6 | ||||
| -rw-r--r-- | src/test/modules/commit_ts/t/001_base.pl | 6 | ||||
| -rw-r--r-- | src/test/modules/commit_ts/t/002_standby.pl | 8 | ||||
| -rw-r--r-- | src/test/modules/commit_ts/t/003_standby_2.pl | 8 | ||||
| -rw-r--r-- | src/test/modules/commit_ts/t/004_restart.pl | 6 | ||||
| -rw-r--r-- | src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl | 10 | ||||
| -rw-r--r-- | src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl | 8 | ||||
| -rw-r--r-- | src/test/modules/test_misc/t/001_constraint_validation.pl | 6 | ||||
| -rw-r--r-- | src/test/modules/test_pg_dump/t/001_base.pl | 10 |
9 files changed, 34 insertions, 34 deletions
diff --git a/src/test/modules/brin/t/01_workitems.pl b/src/test/modules/brin/t/01_workitems.pl index ea2e2944a15..48bb8abfe6e 100644 --- a/src/test/modules/brin/t/01_workitems.pl +++ b/src/test/modules/brin/t/01_workitems.pl @@ -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; diff --git a/src/test/modules/commit_ts/t/001_base.pl b/src/test/modules/commit_ts/t/001_base.pl index 0c504421d44..16f0f122534 100644 --- a/src/test/modules/commit_ts/t/001_base.pl +++ b/src/test/modules/commit_ts/t/001_base.pl @@ -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; diff --git a/src/test/modules/commit_ts/t/002_standby.pl b/src/test/modules/commit_ts/t/002_standby.pl index 227eddeda26..c22956c9ea0 100644 --- a/src/test/modules/commit_ts/t/002_standby.pl +++ b/src/test/modules/commit_ts/t/002_standby.pl @@ -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; diff --git a/src/test/modules/commit_ts/t/003_standby_2.pl b/src/test/modules/commit_ts/t/003_standby_2.pl index 27c5bfbfb73..a6e9f4188e9 100644 --- a/src/test/modules/commit_ts/t/003_standby_2.pl +++ b/src/test/modules/commit_ts/t/003_standby_2.pl @@ -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; diff --git a/src/test/modules/commit_ts/t/004_restart.pl b/src/test/modules/commit_ts/t/004_restart.pl index 5d92c5a2e6d..c0f3a7c8af5 100644 --- a/src/test/modules/commit_ts/t/004_restart.pl +++ b/src/test/modules/commit_ts/t/004_restart.pl @@ -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; diff --git a/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl index 7f648b19a26..4f9b67f2544 100644 --- a/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl +++ b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.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 $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; diff --git a/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl b/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl index 1f28f303f1a..7fcba283e99 100644 --- a/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl +++ b/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl @@ -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'); diff --git a/src/test/modules/test_misc/t/001_constraint_validation.pl b/src/test/modules/test_misc/t/001_constraint_validation.pl index 7c1929f8053..147daf08326 100644 --- a/src/test/modules/test_misc/t/001_constraint_validation.pl +++ b/src/test/modules/test_misc/t/001_constraint_validation.pl @@ -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'); diff --git a/src/test/modules/test_pg_dump/t/001_base.pl b/src/test/modules/test_pg_dump/t/001_base.pl index 17c404c81f2..16f7610883b 100644 --- a/src/test/modules/test_pg_dump/t/001_base.pl +++ b/src/test/modules/test_pg_dump/t/001_base.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; ############################################################### # 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; |
