Fix inconsistent quoting for some options in TAP tests

This commit addresses some inconsistencies with how the options of some
routines from PostgreSQL/Test/ are written, mainly for init() and
init_from_backup() in Cluster.pm.  These are written as unquoted, except
in the locations updated here.

Changes extracted from a larger patch by the same author.

Author: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://postgr.es/m/87jz8rzf3h.fsf@wibble.ilmari.org
This commit is contained in:
Michael Paquier 2025-03-17 14:07:12 +09:00
parent 19c6e92b13
commit 3943f5cff6
10 changed files with 13 additions and 14 deletions

View File

@ -28,7 +28,7 @@ sub query_log
}
my $node = PostgreSQL::Test::Cluster->new('main');
$node->init('auth_extra' => [ '--create-role' => 'regress_user1' ]);
$node->init(auth_extra => [ '--create-role' => 'regress_user1' ]);
$node->append_conf('postgresql.conf',
"session_preload_libraries = 'auto_explain'");
$node->append_conf('postgresql.conf', "auto_explain.log_min_duration = 0");

View File

@ -24,8 +24,8 @@ my $node = PostgreSQL::Test::Cluster->new('primary');
# Make sure pg_hba.conf is set up to allow connections from backupuser.
# This is only needed on Windows machines that don't use UNIX sockets.
$node->init(
'allows_streaming' => 1,
'auth_extra' => [ '--create-role' => 'backupuser' ]);
allows_streaming => 1,
auth_extra => [ '--create-role' => 'backupuser' ]);
$node->append_conf('postgresql.conf',
"shared_preload_libraries = 'basebackup_to_shell'");

View File

@ -470,7 +470,7 @@ SKIP:
$node2->init_from_backup(
$node, 'tarbackup2',
tar_program => $tar,
'tablespace_map' => { $tblspcoid => $realRepTsDir });
tablespace_map => { $tblspcoid => $realRepTsDir });
$node2->start;
my $result = $node2->safe_psql('postgres', 'SELECT * FROM test1');

View File

@ -17,7 +17,7 @@ my @pg_basebackup_defs =
# Set up an instance.
my $node = PostgreSQL::Test::Cluster->new('main');
$node->init('allows_streaming' => 1);
$node->init(allows_streaming => 1);
$node->start();
# Create an in-place tablespace.

View File

@ -52,7 +52,7 @@ EOM
# then stop recovery at some arbitrary LSN, not just when it hits the end of
# WAL, so use a recovery target.
my $node2 = PostgreSQL::Test::Cluster->new('node2');
$node2->init_from_backup($node1, 'backup1', 'has_streaming' => 1);
$node2->init_from_backup($node1, 'backup1', has_streaming => 1);
$node2->append_conf('postgresql.conf', <<EOM);
recovery_target_lsn = '$lsn'
recovery_target_action = 'pause'

View File

@ -869,7 +869,7 @@ my %tests = (
# Create a PG instance to test actually dumping from
my $node = PostgreSQL::Test::Cluster->new('main');
$node->init('auth_extra' => [ '--create-role' => 'regress_dump_login_role' ]);
$node->init(auth_extra => [ '--create-role' => 'regress_dump_login_role' ]);
$node->start;
my $port = $node->port;

View File

@ -1019,7 +1019,7 @@ sub init_from_backup
PostgreSQL::Test::RecursiveCopy::copypath(
$backup_path,
$data_path,
'filterfn' => sub {
filterfn => sub {
my ($path) = @_;
if ($path =~ /^pg_tblspc\/(\d+)$/
&& exists $params{tablespace_map}{$1})

View File

@ -13,7 +13,7 @@ use Test::More;
# Initialize the server with specific low connection limits
my $node = PostgreSQL::Test::Cluster->new('primary');
$node->init(
'auth_extra' => [
auth_extra => [
'--create-role' =>
'regress_regular,regress_reserved,regress_superuser',
]);

View File

@ -71,8 +71,8 @@ my $md5_works = ($node->psql('postgres', "select md5('')") == 0);
$ssl_server->configure_test_server_for_ssl(
$node, $SERVERHOSTADDR, $SERVERHOSTCIDR,
"scram-sha-256",
'password' => "pass",
'password_enc' => "scram-sha-256");
password => "pass",
password_enc => "scram-sha-256");
switch_server_cert($node, certfile => 'server-cn-only');
$ENV{PGPASSWORD} = "pass";
$common_connstr =

View File

@ -186,9 +186,8 @@ foreach my $c (@cases)
$result = $node->safe_psql(
"trustdb",
"SELECT ssl_client_cert_present();",
connstr => "$common_connstr dbname=trustdb $c->{'opts'}");
is($result, $c->{'present'},
"ssl_client_cert_present() for $c->{'opts'}");
connstr => "$common_connstr dbname=trustdb $c->{opts}");
is($result, $c->{present}, "ssl_client_cert_present() for $c->{opts}");
}
done_testing();