mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-01 14:31:18 +02:00
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
This commit is contained in:
parent
8abc13a889
commit
d5ab9a891c
@ -171,21 +171,19 @@ $node->command_ok(
|
||||
system_log('cat', $plain);
|
||||
my ($stderr, $result);
|
||||
my $restore_super = qq{regress_a'b\\c=d\\ne"f};
|
||||
$restore_super =~ s/"//g
|
||||
if $TestLib::windows_os; # IPC::Run mishandles '"' on Windows
|
||||
|
||||
|
||||
# Restore full dump through psql using environment variables for
|
||||
# dbname/user connection parameters
|
||||
|
||||
my $envar_node = get_new_node('destination_envar');
|
||||
$envar_node->init(extra =>
|
||||
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
|
||||
$envar_node->run_log(
|
||||
[
|
||||
$ENV{PG_REGRESS}, '--config-auth',
|
||||
$envar_node->data_dir, '--user',
|
||||
$dst_bootstrap_super, '--create-role',
|
||||
$restore_super
|
||||
]);
|
||||
$envar_node->init(
|
||||
extra =>
|
||||
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ],
|
||||
auth_extra =>
|
||||
[ '--user', $dst_bootstrap_super, '--create-role', $restore_super ]);
|
||||
$envar_node->start;
|
||||
|
||||
# make superuser for restore
|
||||
@ -207,18 +205,12 @@ is($stderr, '', 'no dump errors');
|
||||
# dbname/user connection parameters. "\connect dbname=" forgets
|
||||
# user/port from command line.
|
||||
|
||||
$restore_super =~ s/"//g
|
||||
if $TestLib::windows_os; # IPC::Run mishandles '"' on Windows
|
||||
my $cmdline_node = get_new_node('destination_cmdline');
|
||||
$cmdline_node->init(extra =>
|
||||
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
|
||||
$cmdline_node->run_log(
|
||||
[
|
||||
$ENV{PG_REGRESS}, '--config-auth',
|
||||
$cmdline_node->data_dir, '--user',
|
||||
$dst_bootstrap_super, '--create-role',
|
||||
$restore_super
|
||||
]);
|
||||
$cmdline_node->init(
|
||||
extra =>
|
||||
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ],
|
||||
auth_extra =>
|
||||
[ '--user', $dst_bootstrap_super, '--create-role', $restore_super ]);
|
||||
$cmdline_node->start;
|
||||
$cmdline_node->run_log(
|
||||
[ 'createuser', '-U', $dst_bootstrap_super, '-s', $restore_super ]);
|
||||
|
Loading…
Reference in New Issue
Block a user