On Wed, Apr 07, 2021 at 01:17:34AM +0000, Michael Paquier wrote: > Add some information about authenticated identity via log_connections > > The "authenticated identity" is the string used by an authentication > method to identify a particular user. In many common cases, this is the > same as the PostgreSQL username, but for some third-party authentication > methods, the identifier in use may be shortened or otherwise translated > (e.g. through pg_ident user mappings) before the server stores it.
So, fairywren, that is able to run the SSL tests on Windows, has been complaining here: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=fairywren&dt=2021-04-07 03%3A04%3A44 The issue happens for 4 tests that check if some logs are not generated in the backend after an authentication failure, but the origin of the issue is that the truncation of the log file used to prevent a check of some previous connection's logs does not work properly, as fairywren shows a full-fledged log file in its output. The method used by connect_ok() and connect_fails() is the same as issues_sql_like() in PostgresNode.pm, so it seems to me that there is a pending issue with the latter, no? I think that this could lead to some false positives in tests expecting some general SQL query patterns, with a risk of overlap. A safe solution to this stuff is just to rotate the log file once before restarting the server, like in the attached. I would do that just on Windows to not slow down other systems. Thoughts? -- Michael
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm index 598906ad64..0773287e59 100644 --- a/src/test/perl/PostgresNode.pm +++ b/src/test/perl/PostgresNode.pm @@ -1920,7 +1920,17 @@ sub connect_ok if (@log_like or @log_unlike) { # Don't let previous log entries match for this connection. - truncate $self->logfile, 0; + # On Windows, the truncation would not work, so rotate the log + # file before restarting the server afresh. + if ($TestLib::windows_os) + { + $self->rotate_logfile; + $self->restart; + } + else + { + truncate $self->logfile, 0; + } } # Never prompt for a password, any callers of this routine should @@ -1994,7 +2004,17 @@ sub connect_fails if (@log_like or @log_unlike) { # Don't let previous log entries match for this connection. - truncate $self->logfile, 0; + # On Windows, the truncation would not work, so rotate the log + # file before restarting the server afresh. + if ($TestLib::windows_os) + { + $self->rotate_logfile; + $self->restart; + } + else + { + truncate $self->logfile, 0; + } } # Never prompt for a password, any callers of this routine should @@ -2175,7 +2195,9 @@ Run a command on the node, then verify that $expected_sql appears in the server log file. Reads the whole log file so be careful when working with large log outputs. -The log file is truncated prior to running the command, however. +The log file is truncated prior to running the command, however. On Windows, +the truncation would not work, so rotate to a new log file and restart the +server. =cut @@ -2187,7 +2209,16 @@ sub issues_sql_like local %ENV = $self->_get_env(); - truncate $self->logfile, 0; + if ($TestLib::windows_os) + { + $self->rotate_logfile; + $self->restart; + } + else + { + truncate $self->logfile, 0; + } + my $result = TestLib::run_log($cmd); ok($result, "@$cmd exit code 0"); my $log = TestLib::slurp_file($self->logfile);
signature.asc
Description: PGP signature