pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedRe: [pgjdbc/pgjdbc] PR #3532: Datetime-related tests improved
4+ messages / 2 participants
[nested] [flat]
* Re: [pgjdbc/pgjdbc] PR #3532: Datetime-related tests improved
@ 2025-02-20 12:14 ` "vlsi (@vlsi)" <[email protected]>
3 siblings, 0 replies; 4+ messages in thread
From: vlsi (@vlsi) @ 2025-02-20 12:14 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
(on pgjdbc/src/test/java/org/postgresql/jdbc/TimeZoneTest.java)
As you add assertions, please consider messages that would clarify the reason the assertion is there.
The current assertion would fail as `testConnection[zoneId=Europe/Paris] expected: true, got: false Client and server time are close enough`. I'm not sure it provides enough information to convey why the client and server times must match.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [pgjdbc/pgjdbc] PR #3532: Datetime-related tests improved
@ 2025-02-21 10:15 ` "seregaizsbera (@seregaizsbera)" <[email protected]>
3 siblings, 0 replies; 4+ messages in thread
From: seregaizsbera (@seregaizsbera) @ 2025-02-21 10:15 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
(on pgjdbc/src/test/java/org/postgresql/jdbc/TimeZoneTest.java)
> As you add assertions, please consider messages that would clarify the reason the assertion is there.
>
> The current assertion would fail as `testConnection[zoneId=Europe/Paris] expected: true, got: false Client and server time are close enough`. I'm not sure it provides enough information to convey why the client and server times must match.
If your test failed at Europe/Paris, you most likely caught a bug. This may happen if the server or client clock is wrong, for instance NTP failure. The other reason may be a difference in timezone definitions. The same zone Europe/Paris has different params on client and on server. My test executes successfully at Europe/Paris.
In ideal conditions server and client time must be equal. But we can't receive equal values, since measurement of time doesn't occur simultaneously. That's why it is compared with deviation. The deviation of 10 seconds is enough for this comparison.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [pgjdbc/pgjdbc] PR #3532: Datetime-related tests improved
@ 2025-02-21 10:35 ` "seregaizsbera (@seregaizsbera)" <[email protected]>
3 siblings, 0 replies; 4+ messages in thread
From: seregaizsbera (@seregaizsbera) @ 2025-02-21 10:35 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
(on pgjdbc/src/test/java/org/postgresql/jdbc/TimeZoneTest.java)
Very strange. The Europe/Paris timezone has never changed. It is the last zone I expected to fail. Usually, problems arise with new timezones. This needs to be investigated.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [pgjdbc/pgjdbc] PR #3532: Datetime-related tests improved
@ 2025-02-21 10:40 ` "vlsi (@vlsi)" <[email protected]>
3 siblings, 0 replies; 4+ messages in thread
From: vlsi (@vlsi) @ 2025-02-21 10:40 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
(on pgjdbc/src/test/java/org/postgresql/jdbc/TimeZoneTest.java)
@seregaizsbera , if you happen to understand Russian, I would recommend watching https://www.youtube.com/watch?v=sS3S9PfUwxc which elaborates on why `assertTrue` might be harmful in many cases.
I do not mean the test fails right now. What I mean is `expected: true got: false` makes maintenance much harder.
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2025-02-21 10:40 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-20 12:14 ` "vlsi (@vlsi)" <[email protected]>
2025-02-21 10:15 ` "seregaizsbera (@seregaizsbera)" <[email protected]>
2025-02-21 10:35 ` "seregaizsbera (@seregaizsbera)" <[email protected]>
2025-02-21 10:40 ` "vlsi (@vlsi)" <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox