Skip to content

Commit 3af72c3

Browse files
committed
time partials failure in test because of microseconds rounding
1 parent d305d10 commit 3af72c3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

backend/mr-db-sql/src/test/groovy/io/featurehub/db/services/AuthenticationSpec.groovy

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import org.apache.commons.lang3.RandomStringUtils
1717
import spock.lang.Shared
1818

1919
import java.time.Instant
20+
import java.time.temporal.ChronoField
21+
import java.time.temporal.TemporalField
2022

2123
class AuthenticationSpec extends BaseSpec {
2224
@Shared AuthenticationSqlApi auth
@@ -258,7 +260,7 @@ class AuthenticationSpec extends BaseSpec {
258260
then:
259261
session == originalSession
260262
foundSession.token == originalSession.token
261-
foundSession.lastSeen == originalSession.lastSeen
263+
foundSession.lastSeen.with(ChronoField.MICRO_OF_SECOND, 0) == originalSession.lastSeen.with(ChronoField.MICRO_OF_SECOND, 0)
262264
foundSession.person.id.id == p2.id.id
263265
foundSession.person.email == p2.email
264266
invalidSession == null

backend/mr-db-sql/src/test/groovy/io/featurehub/db/services/ConvertUtilsSpec.groovy

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import io.featurehub.mr.model.SortOrder
1414
import java.time.Instant
1515
import java.time.LocalDateTime
1616
import java.time.ZoneOffset
17+
import java.time.temporal.ChronoField
1718

1819
class ConvertUtilsSpec extends Base2Spec {
1920
PersonSqlApi personSqlApi
@@ -54,7 +55,7 @@ class ConvertUtilsSpec extends Base2Spec {
5455
def peopleClean = personSqlApi.search(email, SortOrder.ASC, 0, 0, Set.of(PersonType.PERSON), null, Opts.empty())
5556
then:
5657
people.people.size() == 1
57-
people.people[0].whenLastAuthenticated == whenLastAuthenticated.atOffset(ZoneOffset.UTC)
58+
people.people[0].whenLastAuthenticated.with(ChronoField.MICRO_OF_SECOND, 0) == whenLastAuthenticated.atOffset(ZoneOffset.UTC).with(ChronoField.MICRO_OF_SECOND, 0)
5859
people.people[0].whenLastSeen == null
5960
peopleClean.people.size() == 1
6061
peopleClean.people[0].whenLastAuthenticated == null
@@ -80,8 +81,8 @@ class ConvertUtilsSpec extends Base2Spec {
8081
def peopleClean = personSqlApi.search(email, SortOrder.ASC, 0, 0, Set.of(PersonType.PERSON), null, Opts.empty())
8182
then:
8283
people.people.size() == 1
83-
people.people[0].whenLastAuthenticated == whenLastAuthenticated.atOffset(ZoneOffset.UTC)
84-
people.people[0].whenLastSeen == whenLastSeen.atOffset(ZoneOffset.UTC)
84+
people.people[0].whenLastAuthenticated.with(ChronoField.MICRO_OF_SECOND, 0) == whenLastAuthenticated.atOffset(ZoneOffset.UTC).with(ChronoField.MICRO_OF_SECOND, 0)
85+
people.people[0].whenLastSeen.with(ChronoField.MICRO_OF_SECOND, 0) == whenLastSeen.atOffset(ZoneOffset.UTC).with(ChronoField.MICRO_OF_SECOND, 0)
8586
peopleClean.people.size() == 1
8687
peopleClean.people[0].whenLastAuthenticated == null
8788
peopleClean.people[0].whenLastSeen == null

0 commit comments

Comments
 (0)