From db97ac888c844de8d1932aa7868edf5637fdd08e Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Wed, 6 Dec 2023 11:42:11 +0100 Subject: [PATCH] test: Harden test of RecoveryStrategy.skip --- .../it/scala/akka/projection/jdbc/JdbcProjectionSpec.scala | 4 +++- .../scala/akka/projection/r2dbc/R2dbcProjectionSpec.scala | 4 +++- .../r2dbc/R2dbcTimestampOffsetProjectionSpec.scala | 4 +++- .../scala/akka/projection/slick/SlickProjectionSpec.scala | 6 ++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/akka-projection-jdbc/src/it/scala/akka/projection/jdbc/JdbcProjectionSpec.scala b/akka-projection-jdbc/src/it/scala/akka/projection/jdbc/JdbcProjectionSpec.scala index 83e350608..535aded8f 100644 --- a/akka-projection-jdbc/src/it/scala/akka/projection/jdbc/JdbcProjectionSpec.scala +++ b/akka-projection-jdbc/src/it/scala/akka/projection/jdbc/JdbcProjectionSpec.scala @@ -361,7 +361,9 @@ class JdbcProjectionSpec projectionTestKit.run(projectionFailing) { projectedValueShouldBe("e1|e2|e3|e4|e5") } - offsetShouldBe(6L) + eventually { + offsetShouldBe(6L) + } } "skip failing events after retrying when using RecoveryStrategy.retryAndSkip" in { diff --git a/akka-projection-r2dbc/src/it/scala/akka/projection/r2dbc/R2dbcProjectionSpec.scala b/akka-projection-r2dbc/src/it/scala/akka/projection/r2dbc/R2dbcProjectionSpec.scala index 2aa73dba3..c0841a420 100644 --- a/akka-projection-r2dbc/src/it/scala/akka/projection/r2dbc/R2dbcProjectionSpec.scala +++ b/akka-projection-r2dbc/src/it/scala/akka/projection/r2dbc/R2dbcProjectionSpec.scala @@ -329,7 +329,9 @@ class R2dbcProjectionSpec projectionTestKit.run(projectionFailing) { projectedValueShouldBe("e1|e2|e3|e4|e5") } - offsetShouldBe(6L) + eventually { + offsetShouldBe(6L) + } } "skip failing events after retrying when using RecoveryStrategy.retryAndSkip" in { diff --git a/akka-projection-r2dbc/src/it/scala/akka/projection/r2dbc/R2dbcTimestampOffsetProjectionSpec.scala b/akka-projection-r2dbc/src/it/scala/akka/projection/r2dbc/R2dbcTimestampOffsetProjectionSpec.scala index 9f40eb9ef..655ce9472 100644 --- a/akka-projection-r2dbc/src/it/scala/akka/projection/r2dbc/R2dbcTimestampOffsetProjectionSpec.scala +++ b/akka-projection-r2dbc/src/it/scala/akka/projection/r2dbc/R2dbcTimestampOffsetProjectionSpec.scala @@ -418,7 +418,9 @@ class R2dbcTimestampOffsetProjectionSpec projectionTestKit.run(projectionFailing) { projectedValueShouldBe("e1|e2|e3|e4|e5") } - offsetShouldBe(envelopes.last.offset) + eventually { + offsetShouldBe(envelopes.last.offset) + } } "skip failing events after retrying when using RecoveryStrategy.retryAndSkip" in { diff --git a/akka-projection-slick/src/test/scala/akka/projection/slick/SlickProjectionSpec.scala b/akka-projection-slick/src/test/scala/akka/projection/slick/SlickProjectionSpec.scala index bafcc9922..36e9102cf 100644 --- a/akka-projection-slick/src/test/scala/akka/projection/slick/SlickProjectionSpec.scala +++ b/akka-projection-slick/src/test/scala/akka/projection/slick/SlickProjectionSpec.scala @@ -273,8 +273,10 @@ class SlickProjectionSpec } } withClue("check - all offsets were seen") { - val offset = offsetStore.readOffset[Long](projectionId).futureValue.value - offset shouldBe 6L + eventually { + val offset = offsetStore.readOffset[Long](projectionId).futureValue.value + offset shouldBe 6L + } } }