diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-07-27 18:58:20 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-07-27 18:58:20 -0400 |
commit | 1d01d198536f24995f2d5271f55c73be644438fc (patch) | |
tree | 212198184ad26101698a646c9cf728b0425298e9 | |
parent | a0c632c1dea74de042110e204bd2dc634e87b7ea (diff) | |
download | postgresql-1d01d198536f24995f2d5271f55c73be644438fc.tar.gz postgresql-1d01d198536f24995f2d5271f55c73be644438fc.zip |
Fix new auto_explain test case for Windows.
In commit 7c34555f8, I overlooked the need to configure SSPI
on Windows to allow login as the non-superuser role.
Fix that by adding auth_extra/--create-role incantation
(which, oddly enough, doesn't actually create the role).
Per buildfarm.
While here, upgrade the mechanism for temporarily setting
$ENV{PGUSER}, as per recommendation from ilmari.
Discussion: https://postgr.es/m/87edy7j1zz.fsf@wibble.ilmari.org
-rw-r--r-- | contrib/auto_explain/t/001_auto_explain.pl | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/contrib/auto_explain/t/001_auto_explain.pl b/contrib/auto_explain/t/001_auto_explain.pl index b34de5f3a87..d49a92f1390 100644 --- a/contrib/auto_explain/t/001_auto_explain.pl +++ b/contrib/auto_explain/t/001_auto_explain.pl @@ -28,7 +28,7 @@ sub query_log } my $node = PostgreSQL::Test::Cluster->new('main'); -$node->init; +$node->init('auth_extra' => [ '--create-role', 'regress_user1' ]); $node->append_conf('postgresql.conf', "session_preload_libraries = 'auto_explain'"); $node->append_conf('postgresql.conf', "auto_explain.log_min_duration = 0"); @@ -115,29 +115,30 @@ CREATE USER regress_user1; GRANT SET ON PARAMETER auto_explain.log_format TO regress_user1; }); -$ENV{PGUSER} = "regress_user1"; +{ + local $ENV{PGUSER} = "regress_user1"; -$log_contents = query_log( - $node, - "SELECT * FROM pg_database;", - { "auto_explain.log_format" => "json" }); + $log_contents = query_log( + $node, + "SELECT * FROM pg_database;", + { "auto_explain.log_format" => "json" }); -like( - $log_contents, - qr/"Query Text": "SELECT \* FROM pg_database;"/, - "query text logged, json mode selected by non-superuser"); + like( + $log_contents, + qr/"Query Text": "SELECT \* FROM pg_database;"/, + "query text logged, json mode selected by non-superuser"); -$log_contents = query_log( - $node, - "SELECT * FROM pg_database;", - { "auto_explain.log_level" => "log" }); + $log_contents = query_log( + $node, + "SELECT * FROM pg_database;", + { "auto_explain.log_level" => "log" }); -like( - $log_contents, - qr/WARNING: permission denied to set parameter "auto_explain\.log_level"/, - "permission failure logged"); + like( + $log_contents, + qr/WARNING: permission denied to set parameter "auto_explain\.log_level"/, + "permission failure logged"); -$ENV{PGUSER} = undef; +} # end queries run as regress_user1 $node->safe_psql( "postgres", q{ |