* Disallow join requests when already part of a cluster * Remove wipe state when joining, since join can only be performed from empty state * When trying to join, only accept gossip from that member * Ignore gossips from unknown (and unreachable) members * Make sure received gossip contains selfAddress * Test join of fresh node with same host:port * Remove JoinTwoClustersSpec * Welcome message as reply to Join * Retry unsucessful join request * AddressUidExtension * Uid in cluster Member identifier To be able to distinguish nodes with same host:port after restart. * Ignore gossip with wrong uid * Renamed Remove command to Shutdown * Use uid in vclock identifier * Update sample, Member apply is private * Disabled config duration syntax and cleanup of io settings * Update documentation
78 lines
2 KiB
Scala
78 lines
2 KiB
Scala
/**
|
|
* Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
|
|
*/
|
|
|
|
package akka.cluster
|
|
|
|
import com.typesafe.config.ConfigFactory
|
|
import akka.remote.testkit.MultiNodeConfig
|
|
import akka.remote.testkit.MultiNodeSpec
|
|
import akka.testkit._
|
|
|
|
object DisallowJoinOfTwoClustersMultiJvmSpec extends MultiNodeConfig {
|
|
val a1 = role("a1")
|
|
val a2 = role("a2")
|
|
val b1 = role("b1")
|
|
val b2 = role("b2")
|
|
val c1 = role("c1")
|
|
|
|
commonConfig(debugConfig(on = false).withFallback(MultiNodeClusterSpec.clusterConfigWithFailureDetectorPuppet))
|
|
}
|
|
|
|
class DisallowJoinOfTwoClustersMultiJvmNode1 extends DisallowJoinOfTwoClustersSpec
|
|
class DisallowJoinOfTwoClustersMultiJvmNode2 extends DisallowJoinOfTwoClustersSpec
|
|
class DisallowJoinOfTwoClustersMultiJvmNode3 extends DisallowJoinOfTwoClustersSpec
|
|
class DisallowJoinOfTwoClustersMultiJvmNode4 extends DisallowJoinOfTwoClustersSpec
|
|
class DisallowJoinOfTwoClustersMultiJvmNode5 extends DisallowJoinOfTwoClustersSpec
|
|
|
|
abstract class DisallowJoinOfTwoClustersSpec
|
|
extends MultiNodeSpec(DisallowJoinOfTwoClustersMultiJvmSpec)
|
|
with MultiNodeClusterSpec {
|
|
|
|
import DisallowJoinOfTwoClustersMultiJvmSpec._
|
|
|
|
"Three different clusters (A, B and C)" must {
|
|
|
|
"not be able to join" taggedAs LongRunningTest in {
|
|
// make sure that the node-to-join is started before other join
|
|
runOn(a1, b1, c1) {
|
|
startClusterNode()
|
|
}
|
|
enterBarrier("first-started")
|
|
|
|
runOn(a1, a2) {
|
|
cluster.join(a1)
|
|
}
|
|
runOn(b1, b2) {
|
|
cluster.join(b1)
|
|
}
|
|
runOn(c1) {
|
|
cluster.join(c1)
|
|
}
|
|
|
|
val expectedSize = if (myself == c1) 1 else 2
|
|
awaitMembersUp(numberOfMembers = expectedSize)
|
|
|
|
enterBarrier("two-members")
|
|
|
|
runOn(b1) {
|
|
cluster.join(a1)
|
|
}
|
|
runOn(b2) {
|
|
cluster.join(c1)
|
|
}
|
|
runOn(c1) {
|
|
cluster.join(a2)
|
|
}
|
|
|
|
// no change expected
|
|
1 to 5 foreach { _ ⇒
|
|
clusterView.members.size must be(expectedSize)
|
|
Thread.sleep(1000)
|
|
}
|
|
|
|
enterBarrier("after-1")
|
|
}
|
|
|
|
}
|
|
}
|