I'm working on a project that's based on Akka Persistent FSM. In particular:
I want to know what the best way is to structure test cases for independence? Since state changes are persisted (this is not well explained in the documentation, but can be seen here), it can be tricky to ensure that my persistent actors always begin in a clean state. Is it necessary to build reset into my actor FSM protocol manually? If so, this seems not-ideal, as it's new behavior that require's testing on its own.
What's the best way to manage the journal itself in testing? Is there an easy way to configure the use of a different journal for testing, without having to make this selection explicit in the actor design itself? The Plugin TCK section of the docs mentions deleting the whole journal file manually. This seems reasonable for testing plugins themselves, but seems like an unnecessarily low-level solution for application code. Perhaps I need to explicitly call through to the journal's asyncDeleteMessagesTo in test tear down? This still seems pretty low-level, but perhaps it's just infrastructure that hasn't been built into the library yet.
application.conf
, or can I simply provide the overrides? At the moment, journal configuration is all I'm doing, but I wondering in advance for when I eventually add more configuration. I don't love the concept of injecting thepersistenceId
, but if that's the best I can do, that's the way to go then. – Statist