Cleaned up cluster membership tests.

Signed-off-by: Jonas Bonér <jonas@jonasboner.com>
This commit is contained in:
Jonas Bonér 2012-03-22 16:22:28 +01:00
parent 80da7b5e36
commit b0279f071a
4 changed files with 13 additions and 50 deletions

View file

@ -334,6 +334,8 @@ object Node extends ExtensionId[Node] with ExtensionIdProvider {
*/
class Node(system: ExtendedActorSystem) extends Extension {
// FIXME rename Node to Cluster
/**
* Represents the state for this Node. Implemented using optimistic lockless concurrency.
* All state is represented by this immutable case class and managed by an AtomicReference.

View file

@ -33,10 +33,7 @@ class ClientDowningSpec extends ClusterSpec("akka.cluster.auto-down = off") with
system1 = ActorSystem("system1", ConfigFactory
.parseString("""
akka {
remote.netty {
hostname = localhost
port=5550
}
remote.netty.port = 5550
}""")
.withFallback(system.settings.config))
.asInstanceOf[ActorSystemImpl]
@ -49,10 +46,7 @@ class ClientDowningSpec extends ClusterSpec("akka.cluster.auto-down = off") with
system2 = ActorSystem("system2", ConfigFactory
.parseString("""
akka {
remote.netty {
hostname = localhost
port = 5551
}
remote.netty.port = 5551
cluster.node-to-join = "akka://system1@localhost:5550"
}""")
.withFallback(system.settings.config))
@ -66,10 +60,7 @@ class ClientDowningSpec extends ClusterSpec("akka.cluster.auto-down = off") with
system3 = ActorSystem("system3", ConfigFactory
.parseString("""
akka {
remote.netty {
hostname = localhost
port=5552
}
remote.netty.port = 5552
cluster.node-to-join = "akka://system1@localhost:5550"
}""")
.withFallback(system.settings.config))
@ -83,10 +74,7 @@ class ClientDowningSpec extends ClusterSpec("akka.cluster.auto-down = off") with
system4 = ActorSystem("system4", ConfigFactory
.parseString("""
akka {
remote.netty {
hostname = localhost
port=5553
}
remote.netty.port = 5553
cluster.node-to-join = "akka://system1@localhost:5550"
}""")
.withFallback(system.settings.config))

View file

@ -33,10 +33,7 @@ class LeaderDowningSpec extends ClusterSpec with ImplicitSender {
system1 = ActorSystem("system1", ConfigFactory
.parseString("""
akka {
remote.netty {
hostname = localhost
port=5550
}
remote.netty.port = 5550
}""")
.withFallback(system.settings.config))
.asInstanceOf[ActorSystemImpl]
@ -49,10 +46,7 @@ class LeaderDowningSpec extends ClusterSpec with ImplicitSender {
system2 = ActorSystem("system2", ConfigFactory
.parseString("""
akka {
remote.netty {
hostname = localhost
port = 5551
}
remote.netty.port = 5551
cluster.node-to-join = "akka://system1@localhost:5550"
}""")
.withFallback(system.settings.config))
@ -66,10 +60,7 @@ class LeaderDowningSpec extends ClusterSpec with ImplicitSender {
system3 = ActorSystem("system3", ConfigFactory
.parseString("""
akka {
remote.netty {
hostname = localhost
port=5552
}
remote.netty.port = 5552
cluster.node-to-join = "akka://system1@localhost:5550"
}""")
.withFallback(system.settings.config))
@ -83,10 +74,7 @@ class LeaderDowningSpec extends ClusterSpec with ImplicitSender {
system4 = ActorSystem("system4", ConfigFactory
.parseString("""
akka {
remote.netty {
hostname = localhost
port=5553
}
remote.netty.port = 5553
cluster.node-to-join = "akka://system1@localhost:5550"
}""")
.withFallback(system.settings.config))

View file

@ -31,50 +31,35 @@ class LeaderElectionSpec extends ClusterSpec with ImplicitSender {
system1 = ActorSystem("system1", ConfigFactory
.parseString("""
akka {
remote.netty {
hostname = localhost
port=5550
}
remote.netty.port = 5550
}""")
.withFallback(system.settings.config))
.asInstanceOf[ActorSystemImpl]
val remote1 = system1.provider.asInstanceOf[RemoteActorRefProvider]
node1 = Node(system1)
val fd1 = node1.failureDetector
val address1 = node1.remoteAddress
// ======= NODE 2 ========
system2 = ActorSystem("system2", ConfigFactory
.parseString("""
akka {
remote.netty {
hostname = localhost
port = 5551
}
remote.netty.port = 5551
cluster.node-to-join = "akka://system1@localhost:5550"
}""")
.withFallback(system.settings.config))
.asInstanceOf[ActorSystemImpl]
val remote2 = system2.provider.asInstanceOf[RemoteActorRefProvider]
node2 = Node(system2)
val fd2 = node2.failureDetector
val address2 = node2.remoteAddress
// ======= NODE 3 ========
system3 = ActorSystem("system3", ConfigFactory
.parseString("""
akka {
remote.netty {
hostname = localhost
port=5552
}
remote.netty.port = 5552
cluster.node-to-join = "akka://system1@localhost:5550"
}""")
.withFallback(system.settings.config))
.asInstanceOf[ActorSystemImpl]
val remote3 = system3.provider.asInstanceOf[RemoteActorRefProvider]
node3 = Node(system3)
val fd3 = node3.failureDetector
val address3 = node3.remoteAddress
"be able to 'elect' a single leader" taggedAs LongRunningTest in {