From 9d32ceef1e961cc4307966324b74ad42f0ca0ff0 Mon Sep 17 00:00:00 2001 From: Peter Vlugter <59895+pvlugter@users.noreply.github.com> Date: Fri, 7 Jun 2024 16:36:04 +1200 Subject: [PATCH] test: correct sequence number for delete single snapshot test --- .../r2dbc/snapshot/R2dbcSnapshotStoreSpec.scala | 12 ++++++++++-- docs/src/main/paradox/snapshots.md | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/core/src/test/scala/akka/persistence/r2dbc/snapshot/R2dbcSnapshotStoreSpec.scala b/core/src/test/scala/akka/persistence/r2dbc/snapshot/R2dbcSnapshotStoreSpec.scala index b6d2d135..dabd5f12 100644 --- a/core/src/test/scala/akka/persistence/r2dbc/snapshot/R2dbcSnapshotStoreSpec.scala +++ b/core/src/test/scala/akka/persistence/r2dbc/snapshot/R2dbcSnapshotStoreSpec.scala @@ -60,12 +60,20 @@ class R2dbcSnapshotStoreSpec extends SnapshotStoreSpec(TestConfig.config) with T result.snapshot.get.snapshot should ===("s-5") } "delete the single snapshot for a pid identified by sequenceNr in snapshot metadata" in { + val senderProbe = TestProbe() + + // first confirm the current sequence number for the snapshot + snapshotStore.tell(LoadSnapshot(pid, SnapshotSelectionCriteria(), Long.MaxValue), senderProbe.ref) + val result = senderProbe.expectMsgType[LoadSnapshotResult] + result.snapshot shouldBe defined + val sequenceNr = result.snapshot.get.metadata.sequenceNr + sequenceNr shouldBe 15 + val md = - SnapshotMetadata(pid, sequenceNr = 2, timestamp = 0) // don't care about timestamp for delete of single snap + SnapshotMetadata(pid, sequenceNr, timestamp = 0) // don't care about timestamp for delete of single snap val cmd = DeleteSnapshot(md) val sub = TestProbe() - val senderProbe = TestProbe() subscribe[DeleteSnapshot](sub.ref) snapshotStore.tell(cmd, senderProbe.ref) sub.expectMsg(cmd) diff --git a/docs/src/main/paradox/snapshots.md b/docs/src/main/paradox/snapshots.md index 8a4df4df..4143eb04 100644 --- a/docs/src/main/paradox/snapshots.md +++ b/docs/src/main/paradox/snapshots.md @@ -21,7 +21,7 @@ configurations are supported. @@@ note Snapshots are optional, and if you know that the application doesn't store many events for each entity it is more -efficient to not enable the snapshot plugin, because then it will not try to read snapshots when recovering the entites. +efficient to not enable the snapshot plugin, because then it will not try to read snapshots when recovering the entities. @@@ See also @ref:[Connection configuration](config.md#connection-configuration).