Merge pull request #662 from akka/wip-cluster-failing-tests-patriknw

Fixed some failing cluster tests
This commit is contained in:
Patrik Nordwall 2012-08-31 03:35:05 -07:00
commit ccfd8454fc
7 changed files with 23 additions and 58 deletions

View file

@ -25,7 +25,7 @@ object JoinInProgressMultiJvmSpec extends MultiNodeConfig {
threshold = 4
acceptable-heartbeat-pause = 1 second
}
}""") // increase the leader action task interval
}""")
.withFallback(MultiNodeClusterSpec.clusterConfig)))
}

View file

@ -11,6 +11,7 @@ import akka.testkit._
import scala.concurrent.util.duration._
import akka.actor.Props
import akka.actor.Actor
import akka.cluster.MemberStatus._
object LeaderLeavingMultiJvmSpec extends MultiNodeConfig {
val first = role("first")
@ -62,7 +63,7 @@ abstract class LeaderLeavingSpec
awaitCond(!cluster.isRunning)
// verify that the LEADER is REMOVED
awaitCond(clusterView.status == MemberStatus.Removed)
awaitCond(clusterView.status == Removed)
} else {
@ -71,6 +72,11 @@ abstract class LeaderLeavingSpec
cluster.subscribe(system.actorOf(Props(new Actor {
def receive = {
case state: CurrentClusterState
if (state.members.exists(m m.address == oldLeaderAddress && m.status == Leaving))
leavingLatch.countDown()
if (state.members.exists(m m.address == oldLeaderAddress && m.status == Exiting))
exitingLatch.countDown()
case MemberLeft(m) if m.address == oldLeaderAddress leavingLatch.countDown()
case MemberExited(m) if m.address == oldLeaderAddress exitingLatch.countDown()
case _ // ignore

View file

@ -12,6 +12,7 @@ import akka.testkit._
import scala.concurrent.util.duration._
import akka.actor.Props
import akka.actor.Actor
import akka.cluster.MemberStatus._
object MembershipChangeListenerExitingMultiJvmSpec extends MultiNodeConfig {
val first = role("first")
@ -22,7 +23,6 @@ object MembershipChangeListenerExitingMultiJvmSpec extends MultiNodeConfig {
debugConfig(on = false)
.withFallback(ConfigFactory.parseString("""
akka.cluster {
leader-actions-interval = 5 s # increase the leader action task interval
unreachable-nodes-reaper-interval = 300 s # turn "off" reaping to unreachable node set
}
""")
@ -58,6 +58,9 @@ abstract class MembershipChangeListenerExitingSpec
val exitingLatch = TestLatch()
cluster.subscribe(system.actorOf(Props(new Actor {
def receive = {
case state: CurrentClusterState
if (state.members.exists(m m.address == address(second) && m.status == Exiting))
exitingLatch.countDown()
case MemberExited(m) if m.address == address(second)
exitingLatch.countDown()
case _ // ignore

View file

@ -17,10 +17,7 @@ object MembershipChangeListenerJoinMultiJvmSpec extends MultiNodeConfig {
val first = role("first")
val second = role("second")
commonConfig(
debugConfig(on = false)
.withFallback(ConfigFactory.parseString("akka.clusterView.leader-actions-interval = 5 s") // increase the leader action task interval to allow time checking for JOIN before leader moves it to UP
.withFallback(MultiNodeClusterSpec.clusterConfig)))
commonConfig(debugConfig(on = false).withFallback(MultiNodeClusterSpec.clusterConfig))
}
class MembershipChangeListenerJoinMultiJvmNode1 extends MembershipChangeListenerJoinSpec with FailureDetectorPuppetStrategy

View file

@ -12,6 +12,7 @@ import akka.testkit._
import akka.actor.Address
import akka.actor.Props
import akka.actor.Actor
import akka.cluster.MemberStatus._
object MembershipChangeListenerLeavingMultiJvmSpec extends MultiNodeConfig {
val first = role("first")
@ -21,7 +22,6 @@ object MembershipChangeListenerLeavingMultiJvmSpec extends MultiNodeConfig {
commonConfig(
debugConfig(on = false)
.withFallback(ConfigFactory.parseString("""
akka.clusterView.leader-actions-interval = 5 s
akka.cluster.unreachable-nodes-reaper-interval = 300 s # turn "off"
"""))
.withFallback(MultiNodeClusterSpec.clusterConfig))
@ -56,6 +56,9 @@ abstract class MembershipChangeListenerLeavingSpec
val latch = TestLatch()
cluster.subscribe(system.actorOf(Props(new Actor {
def receive = {
case state: CurrentClusterState
if (state.members.exists(m m.address == address(second) && m.status == Leaving))
latch.countDown()
case MemberLeft(m) if m.address == address(second)
latch.countDown()
case _ // ignore

View file

@ -1,50 +0,0 @@
/**
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.cluster
import com.typesafe.config.ConfigFactory
import org.scalatest.BeforeAndAfter
import akka.remote.testkit.MultiNodeConfig
import akka.remote.testkit.MultiNodeSpec
import akka.testkit._
import scala.concurrent.util.duration._
object NodeJoinMultiJvmSpec extends MultiNodeConfig {
val first = role("first")
val second = role("second")
commonConfig(
debugConfig(on = false)
.withFallback(ConfigFactory.parseString("akka.clusterView.leader-actions-interval = 5 s") // increase the leader action task interval
.withFallback(MultiNodeClusterSpec.clusterConfig)))
}
class NodeJoinMultiJvmNode1 extends NodeJoinSpec with FailureDetectorPuppetStrategy
class NodeJoinMultiJvmNode2 extends NodeJoinSpec with FailureDetectorPuppetStrategy
abstract class NodeJoinSpec
extends MultiNodeSpec(NodeJoinMultiJvmSpec)
with MultiNodeClusterSpec {
import NodeJoinMultiJvmSpec._
"A cluster node" must {
"join another cluster and get status JOINING - when sending a 'Join' command" taggedAs LongRunningTest in {
runOn(first) {
startClusterNode()
}
enterBarrier("first-started")
runOn(second) {
cluster.join(first)
}
awaitCond(clusterView.members.exists { member member.address == address(second) && member.status == MemberStatus.Joining })
enterBarrier("after")
}
}
}

View file

@ -11,6 +11,7 @@ import akka.testkit._
import scala.concurrent.util.duration._
import akka.actor.Props
import akka.actor.Actor
import akka.cluster.MemberStatus._
object NodeLeavingAndExitingMultiJvmSpec extends MultiNodeConfig {
val first = role("first")
@ -48,6 +49,11 @@ abstract class NodeLeavingAndExitingSpec
val exitingLatch = TestLatch()
cluster.subscribe(system.actorOf(Props(new Actor {
def receive = {
case state: CurrentClusterState
if (state.members.exists(m m.address == secondAddess && m.status == Leaving))
leavingLatch.countDown()
if (state.members.exists(m m.address == secondAddess && m.status == Exiting))
exitingLatch.countDown()
case MemberLeft(m) if m.address == secondAddess leavingLatch.countDown()
case MemberExited(m) if m.address == secondAddess exitingLatch.countDown()