Fix inconsistent quoting for some options in TAP tests
authorMichael Paquier <michael@paquier.xyz>
Mon, 17 Mar 2025 05:07:12 +0000 (14:07 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 17 Mar 2025 05:07:12 +0000 (14:07 +0900)
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

contrib/auto_explain/t/001_auto_explain.pl
contrib/basebackup_to_shell/t/001_basic.pl
src/bin/pg_basebackup/t/010_pg_basebackup.pl
src/bin/pg_basebackup/t/011_in_place_tablespace.pl
src/bin/pg_combinebackup/t/008_promote.pl
src/test/modules/test_pg_dump/t/001_base.pl
src/test/perl/PostgreSQL/Test/Cluster.pm
src/test/postmaster/t/002_connection_limits.pl
src/test/ssl/t/002_scram.pl
src/test/ssl/t/003_sslinfo.pl

index 80c0c19af58b2f1ee961d8e0d0fba87e419f120d..25252604b7d7eb1d1405ad59074f243ccb1f9d59 100644 (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");
index 3ee4603bd3a98467f698583dce7372bd405c955e..4d540147a6de903d999c358565efd8615ac3b604 100644 (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'");
index 89ff26b631432f3a3a628a49999cb4fdeefc4afe..7cdd4442755243908ac87683ef82b8ad0bac8bcd 100644 (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');
index 9e53dada4fac306fc339570f504215c7f26297e9..ec942e54eee872c56d9a2d2c75af5faba9557b6f 100644 (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.
index 732f6397103a9f463a77ea8359072e21a792800f..3a15983f4a1310dc619b957ed637654b1186b68e 100644 (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'
index 7116e5b8df67884c06925dfab5fccfab5b291075..a9bcac4169d7a9722068f781e8a1743eaeab62c5 100644 (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;
index 0750915a9a84a53126b8d104aa19071ad48a0ea8..bab3f3d2dbef87829da8fdcb4a658ee500a787fe 100644 (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})
index 85f5ef03dec0934320be8ce1d6c6616bcf171051..325a00efd47d0a297c5784051bb3dad9ce63b156 100644 (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',
    ]);
index fffc51f4047a3d19b8b60832d6c15cb520fd06f7..9e4947f4e3c98bd210083f2507c5a65433e5dd9a 100644 (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 =
index b9eae8d641bab2fb5d598abf414fa00f98a7d80b..3c756489cdf5ed8c7531aa096413a4563def5cee 100644 (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();