Repository navigation
Fix the partition lookahead test for runs in the 00:00 UTC hour - #5971
Merged
Merged
Conversation
…hour The test compared partition bounds to the raw current time, but provisioning works off hour-truncated timestamps. Near an hour boundary (especially midnight) this mismatch could make the assertions fail intermittently.
rbev
approved these changes
Oct 12, 2026
warwickschroeder
approved these changes
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PartitioningTests.Setup_provisions_whole_days_through_the_lookaheadfails whenever the PostgreSQL audit persistence tests run between 00:00 and 00:59 UTC. CI run 37861906054 failed on Linux-PostgreSql and Windows-PostgreSql, in both attempts, withExpected: greater than or equal to 2026-10-11 00:00:57.538, But was: 2026-10-11 00:00:00.Cause
Setup truncates the current time to the hour and provisions whole-day partitions through that hour plus
AuditHours.Lookahead(48 hours). In the 00:00 hour, the hour plus 48 hours lands exactly on a day boundary, so the last partition ends there. The test compared the end of the provisioned range with the untruncated time plus 48 hours, which can be up to an hour later. In every other hour, rounding up to whole days leaves enough slack to hide the difference.Change
The test now compares against
AuditHours.Truncate(now) + AuditHours.Lookahead, the bound setup uses. Provisioning is unchanged.Why the fix is in the test
At 00:59, setup leaves 47 hours of partitions ahead, which does not put ingestion at risk:
AuditPartitionCustomCheckfails only when less than 12 hours remain.Extending the window would provision an extra day for one hour in every 24 and change none of the above.
Testing
ServiceControl.Audit.Persistence.Tests.PostgreSql, Release: 75/75 with the clock seeded at 00:00:57, and 75/75 on the real clock.PartitioningTestswith the clock seeded at 00:59:59.999, 01:00:00 and 23:59:59.999.