summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier2019-07-04 02:33:42 +0000
committerMichael Paquier2019-07-04 02:33:42 +0000
commitd5ab9a891cb590aad4278026b2edda685f2524a2 (patch)
tree66f3e133eec537a5fd96a0619767a2c8f7b3e444
parent8abc13a88938ef473b8a486186f1b96630450728 (diff)
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
-rw-r--r--src/bin/pg_dump/t/010_dump_connstr.pl32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/bin/pg_dump/t/010_dump_connstr.pl b/src/bin/pg_dump/t/010_dump_connstr.pl
index 048ecf24eb4..dc610fa4943 100644
--- a/src/bin/pg_dump/t/010_dump_connstr.pl
+++ b/src/bin/pg_dump/t/010_dump_connstr.pl
@@ -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 ]);