2012-06-01 16:50:34 +02:00
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
|
|
|
|
|
*/
|
|
|
|
|
package akka.cluster
|
|
|
|
|
|
|
|
|
|
import scala.collection.immutable.SortedSet
|
|
|
|
|
import com.typesafe.config.ConfigFactory
|
|
|
|
|
import akka.remote.testkit.MultiNodeConfig
|
|
|
|
|
import akka.remote.testkit.MultiNodeSpec
|
|
|
|
|
import akka.testkit._
|
|
|
|
|
|
|
|
|
|
object NodeLeavingMultiJvmSpec extends MultiNodeConfig {
|
|
|
|
|
val first = role("first")
|
|
|
|
|
val second = role("second")
|
|
|
|
|
val third = role("third")
|
|
|
|
|
|
|
|
|
|
commonConfig(
|
|
|
|
|
debugConfig(on = false)
|
2012-06-11 16:48:19 +02:00
|
|
|
.withFallback(ConfigFactory.parseString("akka.cluster.unreachable-nodes-reaper-frequency = 30 s"))
|
2012-06-04 11:58:09 +02:00
|
|
|
.withFallback(MultiNodeClusterSpec.clusterConfig))
|
2012-06-01 16:50:34 +02:00
|
|
|
}
|
|
|
|
|
|
2012-06-11 16:48:19 +02:00
|
|
|
class NodeLeavingMultiJvmNode1 extends NodeLeavingSpec with FailureDetectorPuppetStrategy
|
|
|
|
|
class NodeLeavingMultiJvmNode2 extends NodeLeavingSpec with FailureDetectorPuppetStrategy
|
|
|
|
|
class NodeLeavingMultiJvmNode3 extends NodeLeavingSpec with FailureDetectorPuppetStrategy
|
2012-06-01 16:50:34 +02:00
|
|
|
|
2012-06-11 16:48:19 +02:00
|
|
|
abstract class NodeLeavingSpec
|
|
|
|
|
extends MultiNodeSpec(NodeLeavingMultiJvmSpec)
|
2012-06-04 11:58:09 +02:00
|
|
|
with MultiNodeClusterSpec {
|
2012-06-11 16:48:19 +02:00
|
|
|
|
2012-06-01 16:50:34 +02:00
|
|
|
import NodeLeavingMultiJvmSpec._
|
|
|
|
|
|
|
|
|
|
lazy val firstAddress = node(first).address
|
|
|
|
|
lazy val secondAddress = node(second).address
|
|
|
|
|
lazy val thirdAddress = node(third).address
|
|
|
|
|
|
|
|
|
|
"A node that is LEAVING a non-singleton cluster" must {
|
|
|
|
|
|
2012-06-16 00:01:58 +02:00
|
|
|
"be marked as LEAVING in the converged membership table" taggedAs LongRunningTest in {
|
2012-06-01 16:50:34 +02:00
|
|
|
|
2012-06-05 14:13:44 +02:00
|
|
|
awaitClusterUp(first, second, third)
|
2012-06-01 16:50:34 +02:00
|
|
|
|
|
|
|
|
runOn(first) {
|
|
|
|
|
cluster.leave(secondAddress)
|
|
|
|
|
}
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("second-left")
|
2012-06-01 16:50:34 +02:00
|
|
|
|
|
|
|
|
runOn(first, third) {
|
|
|
|
|
awaitCond(cluster.latestGossip.members.exists(_.status == MemberStatus.Leaving))
|
|
|
|
|
|
|
|
|
|
val hasLeft = cluster.latestGossip.members.find(_.status == MemberStatus.Leaving)
|
|
|
|
|
hasLeft must be('defined)
|
|
|
|
|
hasLeft.get.address must be(secondAddress)
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("finished")
|
2012-06-01 16:50:34 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|