summaryrefslogtreecommitdiff
path: root/src/test/perl/PostgresNode.pm
diff options
context:
space:
mode:
authorMichael Paquier2021-04-07 21:55:00 +0000
committerMichael Paquier2021-04-07 21:55:00 +0000
commitc7578fa64019f27edc31261ea49066a4b2569a6c (patch)
tree50f754ee4c3c5983d68cc9ef4450e4f9acbe69a7 /src/test/perl/PostgresNode.pm
parente717a9a18b2e34c9c40e5259ad4d31cd7e420750 (diff)
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/[email protected]
Diffstat (limited to 'src/test/perl/PostgresNode.pm')
-rw-r--r--src/test/perl/PostgresNode.pm24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index 598906ad649..e26b2b3f30e 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