Fix artery test file leak #21484
* Include actor system name in artery dir path to ease debugging leaks * Base class name changed to make actor system autonaming work * Add shutdown hook directly in transport start * Wait for completion in shutdown hook (actual leak fix)
This commit is contained in:
parent
133bafdf04
commit
a939e30b49
28 changed files with 78 additions and 88 deletions
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (C) 2016 Lightbend Inc. <http://www.lightbend.com>
|
||||
*/
|
||||
package akka.remote
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
import akka.remote.testkit.{ FlightRecordingSupport, MultiNodeConfig, MultiNodeSpec, STMultiNodeSpec }
|
||||
import akka.testkit.{ DefaultTimeout, ImplicitSender }
|
||||
import com.typesafe.config.ConfigFactory
|
||||
import org.scalatest.{ Outcome, Suite }
|
||||
|
||||
object RemotingMultiNodeSpec {
|
||||
|
||||
def arteryFlightRecordingConf =
|
||||
ConfigFactory.parseString(
|
||||
s"""
|
||||
akka.remote.artery.advanced.flight-recorder {
|
||||
enabled=on
|
||||
destination=target/flight-recorder-${UUID.randomUUID().toString}.afr
|
||||
}
|
||||
""")
|
||||
|
||||
}
|
||||
|
||||
abstract class RemotingMultiNodeSpec(config: MultiNodeConfig) extends MultiNodeSpec(config)
|
||||
with Suite
|
||||
with STMultiNodeSpec
|
||||
with FlightRecordingSupport
|
||||
with ImplicitSender
|
||||
with DefaultTimeout { self: MultiNodeSpec ⇒
|
||||
|
||||
// Keep track of failure so we can print artery flight recording on failure
|
||||
private var failed = false
|
||||
final override protected def withFixture(test: NoArgTest): Outcome = {
|
||||
val out = super.withFixture(test)
|
||||
if (!out.isSucceeded)
|
||||
failed = true
|
||||
out
|
||||
}
|
||||
|
||||
override def afterTermination(): Unit = {
|
||||
if (failed || sys.props.get("akka.remote.artery.always-dump-flight-recorder").isDefined) {
|
||||
printFlightRecording()
|
||||
}
|
||||
deleteFlightRecorderFile()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue