Skip to content

Commit 5c31afc

Browse files
committed
Avoid time-of-day-dependent failure in log rotation test.
Buildfarm members pogona and petalura have shown a failure when pg_ctl/t/004_logrotate.pl starts just before local midnight. The default rotate-at-midnight behavior occurs just before the Perl script examines current_logfiles, so it figures that the rotation it's already requested has occurred ... but in reality, that rotation happens just after it looks, so the expected new log data goes into a different file than the one it's examining. In HEAD, src/test/kerberos/t/001_auth.pl has acquired similar code that evidently has a related failure mode. Besides being quite new, few buildfarm critters run that test, so it's unsurprising that we've not yet seen a failure there. Fix both cases by setting log_rotation_age = 0 so that no time-based rotation can occur. Also absorb 004_logrotate.pl's decision to set lc_messages = 'C' into the kerberos test, in hopes that it will work in non-English prevailing locales. Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=pogona&dt=2020-12-24%2022%3A10%3A04 Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=petalura&dt=2020-02-01%2022%3A20%3A04
1 parent 558a6e8 commit 5c31afc

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/bin/pg_ctl/t/004_logrotate.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
$node->append_conf(
1313
'postgresql.conf', qq(
1414
logging_collector = on
15+
# these ensure stability of test results:
16+
log_rotation_age = 0
1517
lc_messages = 'C'
1618
));
1719

src/test/kerberos/t/001_auth.pl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,16 @@ END
163163

164164
my $node = get_new_node('node');
165165
$node->init;
166-
$node->append_conf('postgresql.conf', "listen_addresses = '$hostaddr'");
167-
$node->append_conf('postgresql.conf', "krb_server_keyfile = '$keytab'");
168-
$node->append_conf('postgresql.conf', "logging_collector = on");
169-
$node->append_conf('postgresql.conf', "log_connections = on");
166+
$node->append_conf(
167+
'postgresql.conf', qq{
168+
listen_addresses = '$hostaddr'
169+
krb_server_keyfile = '$keytab'
170+
logging_collector = on
171+
log_connections = on
172+
# these ensure stability of test results:
173+
log_rotation_age = 0
174+
lc_messages = 'C'
175+
});
170176
$node->start;
171177

172178
$node->safe_psql('postgres', 'CREATE USER test1;');

0 commit comments

Comments
 (0)