Skip to content

Time-related integration tests failing #467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
toverdijk opened this issue Nov 18, 2021 · 2 comments
Closed

Time-related integration tests failing #467

toverdijk opened this issue Nov 18, 2021 · 2 comments
Labels
status: ideal-for-contribution An issue that a contributor can help us with type: task A general task

Comments

@toverdijk
Copy link
Contributor

Bug Report

Time-related integration tests failing in both CodecBinaryFormatIntegrationTests and CodecTextFormatIntegrationTests.

Versions

  • Driver: 42.3.1
  • Database: 13.3
  • Java: Amazon Corretto 11.0.13 / Amazon Corretto 17.0.1
  • OS: Windows 10 Build 19042

Current Behavior

When running time-related unit tests, they fail:

Stack trace example:
org.opentest4j.AssertionFailedError: 
expected: 06:37:18.602257900Z
 but was: 06:37:18.602258Z

Table schema

n/a

Steps to reproduce

Just run the integration tests on above OS/JDK

Expected behavior/code

The integration tests should pass

Possible Solution

Postgresql stores time with microsecond resolution, whereas the OS/JDK used retrieves the time in the java 8 java.time package with nanosecond resolution with 100 nanosecond precision. This causes the time-related integration to fail unless the nanosecond part is zero (which happens 1 in 10 times).

Since postgresql "only" stores microseconds, we could change the tests to assert with the isEqualToIgnoringNanos(..) instead of isEqualTo(..) function.

A second option is, instead of relying on LocalDateTime.now() (and similar functions in other time-classes), to test with manually constructed times - such as LocalDateTime.of(...) without setting nanos. I think the first option is better.

Additional context

n/a

@toverdijk toverdijk added the status: waiting-for-triage An issue we've not yet triaged label Nov 18, 2021
@mp911de
Copy link
Collaborator

mp911de commented Nov 18, 2021

Thanks for bringing this up. Since you have already looked into it, how about submitting a pull request that truncates nanos to zero in these tests?

@mp911de mp911de added status: ideal-for-contribution An issue that a contributor can help us with type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 18, 2021
@mp911de mp911de added this to the 0.8.11.RELEASE milestone Nov 22, 2021
mp911de pushed a commit that referenced this issue Nov 22, 2021
@mp911de
Copy link
Collaborator

mp911de commented Nov 22, 2021

Thank you for your contribution. That's merged and backported now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ideal-for-contribution An issue that a contributor can help us with type: task A general task
Projects
None yet
Development

No branches or pull requests

2 participants