* issue could be reproduced with sleep(200) before the persistenceTestKit.clearByPersistenceId in EventSourcedBehaviorTestKitImpl * problem is that there is a race condition betwen that clear and that the EventSourcedBehavior is starting concurrently, which can result in that the EventSourcedBehavior may see events from previous test if using same persistenceId * solution is to clearAll before starting the EventSourcedBehavior
This commit is contained in:
parent
cadab9388f
commit
aa4a0dbcbb
1 changed files with 1 additions and 2 deletions
|
|
@ -81,6 +81,7 @@ import akka.persistence.typed.internal.EventSourcedBehaviorImpl
|
|||
private def system: ActorSystem[_] = actorTestKit.system
|
||||
|
||||
override val persistenceTestKit: PersistenceTestKit = PersistenceTestKit(system)
|
||||
persistenceTestKit.clearAll()
|
||||
|
||||
private val probe = actorTestKit.createTestProbe[Any]()
|
||||
private val stateProbe = actorTestKit.createTestProbe[State]()
|
||||
|
|
@ -99,8 +100,6 @@ import akka.persistence.typed.internal.EventSourcedBehaviorImpl
|
|||
|
||||
private var emptyStateVerified = false
|
||||
|
||||
persistenceTestKit.clearByPersistenceId(persistenceId.id)
|
||||
|
||||
override def runCommand(command: Command): CommandResult[Command, Event, State] = {
|
||||
if (serializationSettings.enabled && serializationSettings.verifyCommands)
|
||||
verifySerializationAndThrow(command, "Command")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue