2016-09-16 15:12:40 +02:00
|
|
|
/*
|
2019-01-02 18:55:26 +08:00
|
|
|
* Copyright (C) 2016-2019 Lightbend Inc. <https://www.lightbend.com>
|
2016-09-16 15:12:40 +02:00
|
|
|
*/
|
2018-04-24 16:03:55 +01:00
|
|
|
|
2016-09-16 15:12:40 +02:00
|
|
|
package akka.remote
|
|
|
|
|
|
|
|
|
|
import java.util.UUID
|
|
|
|
|
|
2018-02-16 10:04:45 +01:00
|
|
|
import akka.remote.artery.ArterySpecSupport
|
2016-09-16 15:12:40 +02:00
|
|
|
import akka.remote.testkit.{ FlightRecordingSupport, MultiNodeConfig, MultiNodeSpec, STMultiNodeSpec }
|
|
|
|
|
import akka.testkit.{ DefaultTimeout, ImplicitSender }
|
|
|
|
|
import com.typesafe.config.ConfigFactory
|
|
|
|
|
import org.scalatest.{ Outcome, Suite }
|
|
|
|
|
|
2016-09-19 13:22:54 +02:00
|
|
|
object RemotingMultiNodeSpec {
|
2016-09-16 15:12:40 +02:00
|
|
|
|
2016-11-23 12:02:36 +01:00
|
|
|
def commonConfig =
|
2019-03-11 10:38:24 +01:00
|
|
|
ConfigFactory.parseString(s"""
|
2016-11-23 12:02:36 +01:00
|
|
|
akka.actor.warn-about-java-serializer-usage = off
|
2016-09-16 15:12:40 +02:00
|
|
|
akka.remote.artery.advanced.flight-recorder {
|
|
|
|
|
enabled=on
|
|
|
|
|
destination=target/flight-recorder-${UUID.randomUUID().toString}.afr
|
|
|
|
|
}
|
2019-03-11 10:38:24 +01:00
|
|
|
""").withFallback(ArterySpecSupport.tlsConfig) // TLS only used if transport=tls-tcp
|
2016-09-16 15:12:40 +02:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-11 10:38:24 +01:00
|
|
|
abstract class RemotingMultiNodeSpec(config: MultiNodeConfig)
|
|
|
|
|
extends MultiNodeSpec(config)
|
|
|
|
|
with Suite
|
|
|
|
|
with STMultiNodeSpec
|
|
|
|
|
with FlightRecordingSupport
|
|
|
|
|
with ImplicitSender
|
|
|
|
|
with DefaultTimeout { self: MultiNodeSpec =>
|
2016-09-16 15:12:40 +02:00
|
|
|
|
|
|
|
|
// 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()
|
|
|
|
|
}
|
|
|
|
|
}
|