Skip to content

Commit 8656aba

Browse files
authored
test: correct sequence number for delete single snapshot test (#579)
1 parent ccf6d51 commit 8656aba

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

core/src/test/scala/akka/persistence/r2dbc/snapshot/R2dbcSnapshotStoreSpec.scala

+10-2
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,20 @@ class R2dbcSnapshotStoreSpec extends SnapshotStoreSpec(TestConfig.config) with T
6060
result.snapshot.get.snapshot should ===("s-5")
6161
}
6262
"delete the single snapshot for a pid identified by sequenceNr in snapshot metadata" in {
63+
val senderProbe = TestProbe()
64+
65+
// first confirm the current sequence number for the snapshot
66+
snapshotStore.tell(LoadSnapshot(pid, SnapshotSelectionCriteria(), Long.MaxValue), senderProbe.ref)
67+
val result = senderProbe.expectMsgType[LoadSnapshotResult]
68+
result.snapshot shouldBe defined
69+
val sequenceNr = result.snapshot.get.metadata.sequenceNr
70+
sequenceNr shouldBe 15
71+
6372
val md =
64-
SnapshotMetadata(pid, sequenceNr = 2, timestamp = 0) // don't care about timestamp for delete of single snap
73+
SnapshotMetadata(pid, sequenceNr, timestamp = 0) // don't care about timestamp for delete of single snap
6574
val cmd = DeleteSnapshot(md)
6675
val sub = TestProbe()
6776

68-
val senderProbe = TestProbe()
6977
subscribe[DeleteSnapshot](sub.ref)
7078
snapshotStore.tell(cmd, senderProbe.ref)
7179
sub.expectMsg(cmd)

docs/src/main/paradox/snapshots.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ configurations are supported.
2121

2222
@@@ note
2323
Snapshots are optional, and if you know that the application doesn't store many events for each entity it is more
24-
efficient to not enable the snapshot plugin, because then it will not try to read snapshots when recovering the entites.
24+
efficient to not enable the snapshot plugin, because then it will not try to read snapshots when recovering the entities.
2525
@@@
2626

2727
See also @ref:[Connection configuration](config.md#connection-configuration).

0 commit comments

Comments
 (0)