Skip to content

Fix flaky UTCTime and TimeOfDay roundtrip tests - #98

Closed
marinelli wants to merge 1 commit into
masterfrom
improve-tests
Closed

marinelli wants to merge 1 commit into
masterfrom
improve-tests

Conversation

@marinelli

Copy link
Copy Markdown
Contributor

Arbitrary UTCTime chose a day time between 0 and 86401 seconds, and Arbitrary TimeOfDay chose seconds between 0 and 60. A value at or above the limit is a leap second, e.g. 23:59:60. PostgreSQL has no leap seconds and moves such a time to 00:00:00 on the next day. The returned day then differs from the sent day, and the test fails:

Putting value of type UTCTime through database doesn't change its value: [Failed]
Value doesn't change after getting through database
expected: 0642-03-13 23:59:60.074423477053 UTC
 but got: 0642-03-14 00:00:00.074425 UTC

About one value in 86400 fell into this range. Each run makes 1000 values, so about one run in 80 failed. CI reported it twice.

The generators now stop at 86399.999999 seconds and at 59.999999 seconds. LocalTime and ZonedTime build on TimeOfDay, so the fix covers them too.

@marinelli
marinelli requested a review from arybczak September 18, 2026 06:00
@arybczak

Copy link
Copy Markdown
Contributor

This is already fixed in #95, I'll backport it from there to avoid conflicts when rebasing.

@marinelli marinelli closed this Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants