Skip to content

Commit

Permalink
Fix a timing dependency of a unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
yruslan committed Oct 7, 2024
1 parent fdea270 commit 745315b
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ class OffsetManagerJdbcSuite extends AnyWordSpec with RelationalDbFixture with B
}

"return committed offsets" in {
val now = Instant.now()
val nextHour = now.plusSeconds(3600)
val om = getOffsetManager

val transactionReference = om.startWriteOffsets("table1", infoDate, OffsetType.IntegralType)
Expand All @@ -101,10 +99,13 @@ class OffsetManagerJdbcSuite extends AnyWordSpec with RelationalDbFixture with B

val offset = actualNonEmpty.head.asInstanceOf[CommittedOffset]

val now = Instant.now()
val nextHour = now.plusSeconds(3600)

assert(offset.infoDate == infoDate)
assert(!offset.createdAt.isAfter(now))
assert(offset.createdAt.isBefore(nextHour))
assert(!offset.committedAt.isBefore(now))
assert(offset.committedAt.isBefore(now))
assert(offset.committedAt.isBefore(nextHour))
assert(offset.committedAt.isAfter(actualNonEmpty.head.createdAt))
assert(offset.minOffset == OffsetValue.IntegralValue(1))
Expand Down

0 comments on commit 745315b

Please sign in to comment.