[akka-user] unit testing persistence recovery

2014-07-03 Thread Tim Pigden
Hi I want to unit test that my program behaves correctly through the persistence recovery after unexpected shutdown. I can see how I can do this in completely separate tests running one after the other. But can I do it within a single test? (I'm using specs2 and akka testkit) The problem I

Re: [akka-user] unit testing persistence recovery

2014-07-03 Thread Konrad Malawski
Hello Tim! The PersistentActor is not the guy with the lock, it’s the (LevelDB) journal. You only need 1 actor system running (and one journal) to test what you want, example: class MyPersistentActor(override val persistenceId: String) extends PersistentActor { // … persist events, handle

Re: [akka-user] unit testing persistence recovery

2014-07-03 Thread Tim Pigden
Thanks Ok - just to make sure I've got this straight. If I start a new PeristentActor with the same id as an existing one it will just start in recovery mode regardless of the other one - right? On 3 July 2014 13:16, Konrad Malawski konrad.malaw...@typesafe.com wrote: Small typo, I meant act2

Re: [akka-user] unit testing persistence recovery

2014-07-03 Thread Konrad Malawski
If I start a new PeristentActor with the same id as an existing one it will just start in recovery mode regardless of the other one - right? Yes, it'll recover that persistent state. The other thing you could do is to act ! “boom” it to make it restart, which also triggers the replay. Refer to