Skip to content

Commit d5ab9a8

Browse files
committed
Simplify TAP tests of pg_dump for connection strings
The last set of scenarios did an initialization of nodes followed by an extra command to set up the authentication policy with pg_regress --config-auth. This configuration step can be integrated directly using the option auth_extra from PostgresNode::init when initializing the node, saving from one extra command. On Windows, this also restricts more pg_ident.conf for the SSPI user mapping by removing the entry of the OS user running the test, which is not needed anyway. Note that IPC::Run mishandles double quotes, hence the restore user name is changed to map with that. This was already done in the test as a later step, but not in a consistent way, causing the switch to use auth_extra to fail. Found while reviewing ca129e5. Discussion: https://postgr.es/m/20190703062024.GD3084@paquier.xyz
1 parent 8abc13a commit d5ab9a8

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

src/bin/pg_dump/t/010_dump_connstr.pl

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -171,21 +171,19 @@
171171
system_log('cat', $plain);
172172
my ($stderr, $result);
173173
my $restore_super = qq{regress_a'b\\c=d\\ne"f};
174+
$restore_super =~ s/"//g
175+
if $TestLib::windows_os; # IPC::Run mishandles '"' on Windows
174176

175177

176178
# Restore full dump through psql using environment variables for
177179
# dbname/user connection parameters
178180

179181
my $envar_node = get_new_node('destination_envar');
180-
$envar_node->init(extra =>
181-
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
182-
$envar_node->run_log(
183-
[
184-
$ENV{PG_REGRESS}, '--config-auth',
185-
$envar_node->data_dir, '--user',
186-
$dst_bootstrap_super, '--create-role',
187-
$restore_super
188-
]);
182+
$envar_node->init(
183+
extra =>
184+
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ],
185+
auth_extra =>
186+
[ '--user', $dst_bootstrap_super, '--create-role', $restore_super ]);
189187
$envar_node->start;
190188

191189
# make superuser for restore
@@ -207,18 +205,12 @@
207205
# dbname/user connection parameters. "\connect dbname=" forgets
208206
# user/port from command line.
209207

210-
$restore_super =~ s/"//g
211-
if $TestLib::windows_os; # IPC::Run mishandles '"' on Windows
212208
my $cmdline_node = get_new_node('destination_cmdline');
213-
$cmdline_node->init(extra =>
214-
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
215-
$cmdline_node->run_log(
216-
[
217-
$ENV{PG_REGRESS}, '--config-auth',
218-
$cmdline_node->data_dir, '--user',
219-
$dst_bootstrap_super, '--create-role',
220-
$restore_super
221-
]);
209+
$cmdline_node->init(
210+
extra =>
211+
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ],
212+
auth_extra =>
213+
[ '--user', $dst_bootstrap_super, '--create-role', $restore_super ]);
222214
$cmdline_node->start;
223215
$cmdline_node->run_log(
224216
[ 'createuser', '-U', $dst_bootstrap_super, '-s', $restore_super ]);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy