=act #3738 Fix memory leaks in tests

* afterAll not called when all tests marked as ignore,
  invokeBeforeAllAndAfterAllEvenIfNoTestsAreExpected = true
  should solve that, but changed to pending in Ticket1978 anyway
* Try to shutdown when ActorSystem init fails. It is difficult
  to cover all scenarios, but this should improve the situation.
  This was the reason why DeployerSpec leaked.
* missing shutdown in some tests
This commit is contained in:
Patrik Nordwall 2014-01-17 15:52:20 +01:00
parent 8d2bc2bc40
commit 9eb32a4486
6 changed files with 34 additions and 12 deletions

View file

@ -10,8 +10,9 @@ import scala.collection.immutable.Seq
//#plugin-imports
import com.typesafe.config._
import org.scalatest.WordSpec
import scala.concurrent.duration._
import akka.testkit.TestKit
import akka.actor.ActorSystem
//#plugin-imports
@ -69,8 +70,12 @@ class PersistencePluginDocSpec extends WordSpec {
//#snapshot-store-plugin-config
"""
val system = ActorSystem("doc", ConfigFactory.parseString(providerConfig).withFallback(ConfigFactory.parseString(PersistencePluginDocSpec.config)))
val extension = Persistence(system)
val system = ActorSystem("PersistencePluginDocSpec", ConfigFactory.parseString(providerConfig).withFallback(ConfigFactory.parseString(PersistencePluginDocSpec.config)))
try {
Persistence(system)
} finally {
TestKit.shutdownActorSystem(system, 10.seconds, false)
}
}
}