-
Notifications
You must be signed in to change notification settings - Fork 695
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Fix failing datetime tests in MariaDB
The following tests in exposed-java-time and exposed-kotlin-datetime fail when run using MariaDB: KotlinTimeTests/'test string LocalDateTime with nanos'() JavaTimeTests/'test string LocalDateTime with nanos'() - Fails with the message `Failed on microseconds` because Exposed's assertion functions for the fractional part are using `roundToMicro()` to compare nanoseconds. In other databases (DB), including MySQL, the nanoseconds retrieved from the DB is rounded to the internal precision using RoundingMode.HALF_UP. MariaDB always rounds down. - These tests are flaky because they rely on Clock.System.now() (and the java equivalent) and add a set amount of nanoseconds to a dynamic datetime value. This means any resulting value on the lower half of a microsecond will be round down and pass. - The assertion has been changed to floor the nanoseconds value instead and the test now takes 2 values with constant nanoseconds to evaluate what happens when the value is low versus high.
- Loading branch information
Showing
2 changed files
with
62 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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