From d5433fff5bee5c55457756c3c2e3de898a3b57f4 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Fri, 22 Nov 2024 11:34:14 +0100 Subject: [PATCH] test: Harden DynamoDBTimestampOffsetProjectionSpec (#1264) * failing test: "store offset for failing events when using RecoveryStrategy.skip" * projection might have been stopped before the error occured --- .../dynamodb/DynamoDBTimestampOffsetProjectionSpec.scala | 1 + .../src/test/scala/akka/projection/jdbc/JdbcProjectionSpec.scala | 1 + .../test/scala/akka/projection/r2dbc/R2dbcProjectionSpec.scala | 1 + .../projection/r2dbc/R2dbcTimestampOffsetProjectionSpec.scala | 1 + 4 files changed, 4 insertions(+) diff --git a/akka-projection-dynamodb-integration/src/test/scala/akka/projection/dynamodb/DynamoDBTimestampOffsetProjectionSpec.scala b/akka-projection-dynamodb-integration/src/test/scala/akka/projection/dynamodb/DynamoDBTimestampOffsetProjectionSpec.scala index 42ea24a6a..d9fe789e7 100644 --- a/akka-projection-dynamodb-integration/src/test/scala/akka/projection/dynamodb/DynamoDBTimestampOffsetProjectionSpec.scala +++ b/akka-projection-dynamodb-integration/src/test/scala/akka/projection/dynamodb/DynamoDBTimestampOffsetProjectionSpec.scala @@ -921,6 +921,7 @@ class DynamoDBTimestampOffsetProjectionSpec offsetShouldBeEmpty() projectionTestKit.run(projectionFailing) { projectedTestValueShouldBe("e1|e2|e3|e4|e5") + bogusEventHandler.attempts shouldBe 1 } eventually { latestOffsetShouldBe(envelopes.last.offset) diff --git a/akka-projection-jdbc-integration/src/test/scala/akka/projection/jdbc/JdbcProjectionSpec.scala b/akka-projection-jdbc-integration/src/test/scala/akka/projection/jdbc/JdbcProjectionSpec.scala index 87e871c33..a1c7506d0 100644 --- a/akka-projection-jdbc-integration/src/test/scala/akka/projection/jdbc/JdbcProjectionSpec.scala +++ b/akka-projection-jdbc-integration/src/test/scala/akka/projection/jdbc/JdbcProjectionSpec.scala @@ -360,6 +360,7 @@ class JdbcProjectionSpec offsetShouldBeEmpty() projectionTestKit.run(projectionFailing) { projectedValueShouldBe("e1|e2|e3|e4|e5") + bogusEventHandler.attempts shouldBe 1 } eventually { offsetShouldBe(6L) diff --git a/akka-projection-r2dbc-integration/src/test/scala/akka/projection/r2dbc/R2dbcProjectionSpec.scala b/akka-projection-r2dbc-integration/src/test/scala/akka/projection/r2dbc/R2dbcProjectionSpec.scala index 9b031eab2..01d4465ea 100644 --- a/akka-projection-r2dbc-integration/src/test/scala/akka/projection/r2dbc/R2dbcProjectionSpec.scala +++ b/akka-projection-r2dbc-integration/src/test/scala/akka/projection/r2dbc/R2dbcProjectionSpec.scala @@ -363,6 +363,7 @@ class R2dbcProjectionSpec offsetShouldBeEmpty() projectionTestKit.run(projectionFailing) { projectedValueShouldBe("e1|e2|e3|e4|e5") + bogusEventHandler.attempts shouldBe 1 } eventually { offsetShouldBe(6L) diff --git a/akka-projection-r2dbc-integration/src/test/scala/akka/projection/r2dbc/R2dbcTimestampOffsetProjectionSpec.scala b/akka-projection-r2dbc-integration/src/test/scala/akka/projection/r2dbc/R2dbcTimestampOffsetProjectionSpec.scala index 6a45e09b0..60f570929 100644 --- a/akka-projection-r2dbc-integration/src/test/scala/akka/projection/r2dbc/R2dbcTimestampOffsetProjectionSpec.scala +++ b/akka-projection-r2dbc-integration/src/test/scala/akka/projection/r2dbc/R2dbcTimestampOffsetProjectionSpec.scala @@ -418,6 +418,7 @@ class R2dbcTimestampOffsetProjectionSpec offsetShouldBeEmpty() projectionTestKit.run(projectionFailing) { projectedValueShouldBe("e1|e2|e3|e4|e5") + bogusEventHandler.attempts shouldBe 1 } eventually { offsetShouldBe(envelopes.last.offset)