Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: correct sequence number for delete single snapshot test #579

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/paradox/snapshots.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down