Remove unnecessary PGDATABASE settings from TAP tests
authorMichael Paquier <michael@paquier.xyz>
Wed, 3 Jan 2024 01:28:05 +0000 (10:28 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 3 Jan 2024 01:28:05 +0000 (10:28 +0900)
Some of the TAP tests have been historically setting the environment
variable PGDATABASE to 'postgres', which is not needed because
PostgreSQL::Test::Cluster already sets it when initialized.  This commit
removes these explicit setups.

Note that the dependency of cluster -a with PGDATABASE (from
1caef31d9e55) is still documented.

Author: Bharath Rupireddy
Discussion: https://postgr.es/m/CALj2ACXLAz5dW3ZP+Fec8g6jQMMmDyCVT+qdbye2h7QJJmhsdw@mail.gmail.com

src/bin/scripts/t/011_clusterdb_all.pl
src/test/recovery/t/004_timeline_switch.pl
src/test/recovery/t/019_replslot_limit.pl

index 26315d0a5102998e9ae601a5e2404c23ffe7eb81..f1cb5e3f15542d2cb8d382d8064f0f8b4aa01ef4 100644 (file)
@@ -12,10 +12,8 @@ my $node = PostgreSQL::Test::Cluster->new('main');
 $node->init;
 $node->start;
 
-# clusterdb -a is not compatible with -d, hence enforce environment variable
-# correctly.
-$ENV{PGDATABASE} = 'postgres';
-
+# clusterdb -a is not compatible with -d.  This relies on PGDATABASE to be
+# set, something PostgreSQL::Test::Cluster does.
 $node->issues_sql_like(
        [ 'clusterdb', '-a' ],
        qr/statement: CLUSTER.*statement: CLUSTER/s,
index 2500201b9951f287ed65a437fcb5f07c85a10571..58d1f2ffc1b1bf1626dfe705f0a1884f67b6463f 100644 (file)
@@ -8,8 +8,6 @@ use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
 
-$ENV{PGDATABASE} = 'postgres';
-
 # Ensure that a cascading standby is able to follow a newly-promoted standby
 # on a new timeline.
 
index 22ca8ecb5cc494b4e4bbe2b83dbde2fe1199a5f9..8a727c9bda23468a8f55e25d5cb83185c898cba0 100644 (file)
@@ -12,8 +12,6 @@ use PostgreSQL::Test::Cluster;
 use Test::More;
 use Time::HiRes qw(usleep);
 
-$ENV{PGDATABASE} = 'postgres';
-
 # Initialize primary node, setting wal-segsize to 1MB
 my $node_primary = PostgreSQL::Test::Cluster->new('primary');
 $node_primary->init(allows_streaming => 1, extra => ['--wal-segsize=1']);