Add some logging to track down #20180

This commit is contained in:
Arnout Engelen 2017-07-24 15:16:32 +02:00 committed by Konrad `ktoso` Malawski
parent c0e90a0e70
commit a01eea8f25

View file

@ -35,6 +35,7 @@ class RemoteReDeploymentConfig(artery: Boolean) extends MultiNodeConfig {
acceptable-heartbeat-pause=2.5s
}
akka.remote.artery.enabled = $artery
akka.loglevel = INFO
""")).withFallback(RemotingMultiNodeSpec.commonConfig))
testTransport(on = true)
@ -79,16 +80,18 @@ abstract class RemoteReDeploymentSlowMultiJvmSpec(artery: Boolean) extends Remot
}
object RemoteReDeploymentMultiJvmSpec {
class Parent extends Actor {
class Parent extends Actor with ActorLogging {
val monitor = context.actorSelection("/user/echo")
log.info(s"Started Parent on path ${self.path}")
def receive = {
case (p: Props, n: String) context.actorOf(p, n)
case msg monitor ! msg
}
}
class Hello extends Actor {
class Hello extends Actor with ActorLogging {
val monitor = context.actorSelection("/user/echo")
log.info(s"Started Hello on path ${self.path} with parent ${context.parent.path}")
context.parent ! "HelloParent"
override def preStart(): Unit = monitor ! "PreStart"
override def postStop(): Unit = monitor ! "PostStop"
@ -119,26 +122,32 @@ abstract class RemoteReDeploymentMultiJvmSpec(multiNodeConfig: RemoteReDeploymen
"A remote deployment target system" must {
"terminate the child when its parent system is replaced by a new one" in {
// Any message sent to `echo` will be passed on to `testActor`
val echo = system.actorOf(echoProps(testActor), "echo")
enterBarrier("echo-started")
runOn(second) {
// Create a 'Parent' actor on the 'second' node
// have it create a 'Hello' child (which will be on the 'first' node due to the deployment config):
system.actorOf(Props[Parent], "parent") ! ((Props[Hello], "hello"))
// The 'Hello' child will send "HelloParent" to the 'Parent', which will pass it to the 'echo' monitor:
expectMsg(15.seconds, "HelloParent")
}
runOn(first) {
// Check the 'Hello' actor was started on the first node
expectMsg(15.seconds, "PreStart")
}
enterBarrier("first-deployed")
// Disconnect the second system from the first, and shut it down
runOn(first) {
testConductor.blackhole(second, first, Both).await
testConductor.shutdown(second, abort = true).await
if (expectQuarantine)
within(sleepAfterKill) {
// The quarantine of node 2, where the Parent lives, should cause the Hello child to be stopped:
expectMsg("PostStop")
expectNoMsg()
}
@ -148,6 +157,7 @@ abstract class RemoteReDeploymentMultiJvmSpec(multiNodeConfig: RemoteReDeploymen
var sys: ActorSystem = null
// Start the second system again
runOn(second) {
Await.ready(system.whenTerminated, 30.seconds)
expectNoMsg(sleepAfterKill)
@ -156,6 +166,7 @@ abstract class RemoteReDeploymentMultiJvmSpec(multiNodeConfig: RemoteReDeploymen
enterBarrier("cable-cut")
// add new echo, parent, and (if needed) Hello actors:
runOn(second) {
val p = TestProbe()(sys)
sys.actorOf(echoProps(p.ref), "echo")
@ -165,6 +176,7 @@ abstract class RemoteReDeploymentMultiJvmSpec(multiNodeConfig: RemoteReDeploymen
enterBarrier("re-deployed")
// Check the Hello actor is (re)started on node 1:
runOn(first) {
within(15.seconds) {
if (expectQuarantine) expectMsg("PreStart")
@ -174,8 +186,10 @@ abstract class RemoteReDeploymentMultiJvmSpec(multiNodeConfig: RemoteReDeploymen
enterBarrier("the-end")
// After this we expect no further messages
expectNoMsg(1.second)
// Until we clean up after ourselves
enterBarrier("stopping")
runOn(second) {