-
Notifications
You must be signed in to change notification settings - Fork 694
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 (#1805)
* 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
70 additions
and
40 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