Test case for persistence plugins re large snapshots #21704

This commit is contained in:
Sergey Kisel 2016-10-27 09:20:38 +02:00 committed by Johan Andrén
parent f970412af7
commit 26fedc0e36

View file

@ -52,6 +52,13 @@ abstract class SnapshotStoreSpec(config: Config) extends PluginSpec(config)
}
}
/**
* The limit defines a number of bytes persistence plugin can support to store the snapshot.
* If plugin does not support persistence of the snapshots of 10000 bytes or may support more than default size,
* the value can be overriden by the SnapshotStoreSpec implementation with a note in a plugin documentation.
*/
def snapshotByteSizeLimit = 10000
"A snapshot store" must {
"not load a snapshot given an invalid persistenceId" in {
snapshotStore.tell(LoadSnapshot("invalid", SnapshotSelectionCriteria.Latest, Long.MaxValue), senderProbe.ref)
@ -137,5 +144,11 @@ abstract class SnapshotStoreSpec(config: Config) extends PluginSpec(config)
result.snapshot.get.metadata.sequenceNr should be(md.sequenceNr)
// metadata timestamp may have been changed
}
s"save bigger size snapshot ($snapshotByteSizeLimit bytes)" in {
val metadata = SnapshotMetadata(pid, 100)
val bigSnapshot = "0" * snapshotByteSizeLimit
snapshotStore.tell(SaveSnapshot(metadata, bigSnapshot), senderProbe.ref)
senderProbe.expectMsgPF() { case SaveSnapshotSuccess(md) md }
}
}
}