1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Apply more consistent style for command options in TAP tests

This commit reshapes the grammar of some commands to apply a more
consistent style across the board, following rules similar to
ce1b0f9da0:
- Elimination of some pointless used-once variables.
- Use of long options, to self-document better the options used.
- Use of fat commas to link option names and their assigned values,
including redirections, so as perltidy can be tricked to put them
together.

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 12:42:23 +09:00
parent 5721e5453e
commit 19c6e92b13
43 changed files with 522 additions and 399 deletions

View File

@ -69,8 +69,9 @@ sub primary_psql
my $cmd = shift;
my $dbname = shift || 'postgres';
system_or_bail 'psql', '-q', '--no-psqlrc', '-d',
$node_primary->connstr($dbname), '-c', "$cmd";
system_or_bail 'psql', '--quiet', '--no-psqlrc',
'--dbname' => $node_primary->connstr($dbname),
'--command' => $cmd;
return;
}
@ -79,8 +80,9 @@ sub standby_psql
my $cmd = shift;
my $dbname = shift || 'postgres';
system_or_bail 'psql', '-q', '--no-psqlrc', '-d',
$node_standby->connstr($dbname), '-c', "$cmd";
system_or_bail 'psql', '--quiet', '--no-psqlrc',
'--dbname' => $node_standby->connstr($dbname),
'--command' => $cmd;
return;
}
@ -95,11 +97,12 @@ sub check_query
# we want just the output, no formatting
my $result = run [
'psql', '-q', '-A', '-t', '--no-psqlrc', '-d',
$node_primary->connstr('postgres'),
'-c', $query
'psql', '--quiet', '--no-align', '--tuples-only', '--no-psqlrc',
'--dbname' => $node_primary->connstr('postgres'),
'--command' => $query
],
'>', \$stdout, '2>', \$stderr;
'>' => \$stdout,
'2>' => \$stderr;
is($result, 1, "$test_name: psql exit code");
is($stderr, '', "$test_name: psql no stderr");
@ -124,7 +127,7 @@ sub setup_cluster
$node_primary->init(
allows_streaming => 1,
extra => $extra,
auth_extra => [ '--create-role', 'rewind_user' ]);
auth_extra => [ '--create-role' => 'rewind_user' ]);
# Set wal_keep_size to prevent WAL segment recycling after enforced
# checkpoints in the tests.