Commit d5ab9a89 authored by Michael Paquier's avatar Michael Paquier

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 ca129e58.

Discussion: https://postgr.es/m/20190703062024.GD3084@paquier.xyz
parent 8abc13a8
...@@ -171,21 +171,19 @@ $node->command_ok( ...@@ -171,21 +171,19 @@ $node->command_ok(
system_log('cat', $plain); system_log('cat', $plain);
my ($stderr, $result); my ($stderr, $result);
my $restore_super = qq{regress_a'b\\c=d\\ne"f}; 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 # Restore full dump through psql using environment variables for
# dbname/user connection parameters # dbname/user connection parameters
my $envar_node = get_new_node('destination_envar'); my $envar_node = get_new_node('destination_envar');
$envar_node->init(extra => $envar_node->init(
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ]); extra =>
$envar_node->run_log( [ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ],
[ auth_extra =>
$ENV{PG_REGRESS}, '--config-auth', [ '--user', $dst_bootstrap_super, '--create-role', $restore_super ]);
$envar_node->data_dir, '--user',
$dst_bootstrap_super, '--create-role',
$restore_super
]);
$envar_node->start; $envar_node->start;
# make superuser for restore # make superuser for restore
...@@ -207,18 +205,12 @@ is($stderr, '', 'no dump errors'); ...@@ -207,18 +205,12 @@ is($stderr, '', 'no dump errors');
# dbname/user connection parameters. "\connect dbname=" forgets # dbname/user connection parameters. "\connect dbname=" forgets
# user/port from command line. # 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'); my $cmdline_node = get_new_node('destination_cmdline');
$cmdline_node->init(extra => $cmdline_node->init(
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ]); extra =>
$cmdline_node->run_log( [ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ],
[ auth_extra =>
$ENV{PG_REGRESS}, '--config-auth', [ '--user', $dst_bootstrap_super, '--create-role', $restore_super ]);
$cmdline_node->data_dir, '--user',
$dst_bootstrap_super, '--create-role',
$restore_super
]);
$cmdline_node->start; $cmdline_node->start;
$cmdline_node->run_log( $cmdline_node->run_log(
[ 'createuser', '-U', $dst_bootstrap_super, '-s', $restore_super ]); [ 'createuser', '-U', $dst_bootstrap_super, '-s', $restore_super ]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment