Fix some failures with connection tests on Windows hosts

The truncation of the log file, that this set of tests relies on to make
sure that a connection attempt matches with its expected backend log
pattern, fails, as reported by buildfarm member fairywren.  Instead of a
truncation, do a rotation of the log file and restart the node.  This
will ensure that the connection attempt data is unique for each test.

Discussion: https://postgr.es/m/YG05nCI8x8B+Ad3G@paquier.xyz
This commit is contained in:
Michael Paquier 2021-04-08 06:55:00 +09:00
parent e717a9a18b
commit c7578fa640

View File

@ -1920,8 +1920,18 @@ sub connect_ok
if (@log_like or @log_unlike)
{
# Don't let previous log entries match for this connection.
# 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
# have set up things properly, and this should not block.
@ -1994,8 +2004,18 @@ sub connect_fails
if (@log_like or @log_unlike)
{
# Don't let previous log entries match for this connection.
# 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
# have set up things properly, and this should not block.