2012-05-25 17:29:29 +02:00
|
|
|
/**
|
2018-01-04 17:26:29 +00:00
|
|
|
* Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com>
|
2012-05-25 17:29:29 +02:00
|
|
|
*/
|
|
|
|
|
package akka.cluster
|
|
|
|
|
|
|
|
|
|
import com.typesafe.config.ConfigFactory
|
|
|
|
|
import akka.remote.testkit.MultiNodeConfig
|
|
|
|
|
import akka.remote.testkit.MultiNodeSpec
|
|
|
|
|
import akka.testkit._
|
|
|
|
|
import akka.actor.Address
|
2012-10-30 15:08:41 +01:00
|
|
|
import scala.collection.immutable
|
2012-05-25 17:29:29 +02:00
|
|
|
|
2014-03-07 13:20:01 +01:00
|
|
|
final case class ClientDowningNodeThatIsUnreachableMultiNodeConfig(failureDetectorPuppet: Boolean) extends MultiNodeConfig {
|
2012-05-28 14:39:36 +02:00
|
|
|
val first = role("first")
|
2012-05-25 17:29:29 +02:00
|
|
|
val second = role("second")
|
2012-05-28 14:39:36 +02:00
|
|
|
val third = role("third")
|
2012-05-25 17:29:29 +02:00
|
|
|
val fourth = role("fourth")
|
|
|
|
|
|
2012-09-06 21:48:40 +02:00
|
|
|
commonConfig(debugConfig(on = false).withFallback(MultiNodeClusterSpec.clusterConfig(failureDetectorPuppet)))
|
2012-05-25 17:29:29 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-06 21:48:40 +02:00
|
|
|
class ClientDowningNodeThatIsUnreachableWithFailureDetectorPuppetMultiJvmNode1 extends ClientDowningNodeThatIsUnreachableSpec(failureDetectorPuppet = true)
|
|
|
|
|
class ClientDowningNodeThatIsUnreachableWithFailureDetectorPuppetMultiJvmNode2 extends ClientDowningNodeThatIsUnreachableSpec(failureDetectorPuppet = true)
|
|
|
|
|
class ClientDowningNodeThatIsUnreachableWithFailureDetectorPuppetMultiJvmNode3 extends ClientDowningNodeThatIsUnreachableSpec(failureDetectorPuppet = true)
|
|
|
|
|
class ClientDowningNodeThatIsUnreachableWithFailureDetectorPuppetMultiJvmNode4 extends ClientDowningNodeThatIsUnreachableSpec(failureDetectorPuppet = true)
|
2012-06-11 16:48:19 +02:00
|
|
|
|
2012-09-06 21:48:40 +02:00
|
|
|
class ClientDowningNodeThatIsUnreachableWithAccrualFailureDetectorMultiJvmNode1 extends ClientDowningNodeThatIsUnreachableSpec(failureDetectorPuppet = false)
|
|
|
|
|
class ClientDowningNodeThatIsUnreachableWithAccrualFailureDetectorMultiJvmNode2 extends ClientDowningNodeThatIsUnreachableSpec(failureDetectorPuppet = false)
|
|
|
|
|
class ClientDowningNodeThatIsUnreachableWithAccrualFailureDetectorMultiJvmNode3 extends ClientDowningNodeThatIsUnreachableSpec(failureDetectorPuppet = false)
|
|
|
|
|
class ClientDowningNodeThatIsUnreachableWithAccrualFailureDetectorMultiJvmNode4 extends ClientDowningNodeThatIsUnreachableSpec(failureDetectorPuppet = false)
|
2012-05-25 17:29:29 +02:00
|
|
|
|
2012-09-06 21:48:40 +02:00
|
|
|
abstract class ClientDowningNodeThatIsUnreachableSpec(multiNodeConfig: ClientDowningNodeThatIsUnreachableMultiNodeConfig)
|
|
|
|
|
extends MultiNodeSpec(multiNodeConfig)
|
2012-06-04 23:21:28 +02:00
|
|
|
with MultiNodeClusterSpec {
|
|
|
|
|
|
2012-09-06 21:48:40 +02:00
|
|
|
def this(failureDetectorPuppet: Boolean) = this(ClientDowningNodeThatIsUnreachableMultiNodeConfig(failureDetectorPuppet))
|
|
|
|
|
|
|
|
|
|
import multiNodeConfig._
|
2012-05-25 17:29:29 +02:00
|
|
|
|
|
|
|
|
"Client of a 4 node cluster" must {
|
|
|
|
|
|
|
|
|
|
"be able to DOWN a node that is UNREACHABLE (killed)" taggedAs LongRunningTest in {
|
2012-06-18 11:54:44 +02:00
|
|
|
val thirdAddress = address(third)
|
2012-06-05 14:13:44 +02:00
|
|
|
awaitClusterUp(first, second, third, fourth)
|
2012-05-25 17:29:29 +02:00
|
|
|
|
2012-06-05 14:13:44 +02:00
|
|
|
runOn(first) {
|
2012-05-25 17:29:29 +02:00
|
|
|
// kill 'third' node
|
2013-04-23 16:44:14 +02:00
|
|
|
testConductor.exit(third, 0).await
|
2012-06-11 16:48:19 +02:00
|
|
|
markNodeAsUnavailable(thirdAddress)
|
2012-05-25 17:29:29 +02:00
|
|
|
|
|
|
|
|
// mark 'third' node as DOWN
|
2012-05-27 21:22:30 +02:00
|
|
|
cluster.down(thirdAddress)
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("down-third-node")
|
2012-05-25 17:29:29 +02:00
|
|
|
|
2013-03-05 21:05:11 +01:00
|
|
|
awaitMembersUp(numberOfMembers = 3, canNotBePartOfMemberRing = Set(thirdAddress))
|
2015-01-16 11:09:59 +01:00
|
|
|
clusterView.members.exists(_.address == thirdAddress) should ===(false)
|
2012-05-25 17:29:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
runOn(third) {
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("down-third-node")
|
2012-05-25 17:29:29 +02:00
|
|
|
}
|
|
|
|
|
|
2012-05-27 21:22:30 +02:00
|
|
|
runOn(second, fourth) {
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("down-third-node")
|
2012-05-25 17:29:29 +02:00
|
|
|
|
2013-03-05 21:05:11 +01:00
|
|
|
awaitMembersUp(numberOfMembers = 3, canNotBePartOfMemberRing = Set(thirdAddress))
|
2012-05-25 17:29:29 +02:00
|
|
|
}
|
2012-06-05 14:13:44 +02:00
|
|
|
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("await-completion")
|
2012-05-25 17:29:29 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|