Minor corrections and cleanup

This commit is contained in:
Patrik Nordwall 2012-05-30 17:17:09 +02:00
parent cd8e0ab3b1
commit e469561543
4 changed files with 17 additions and 15 deletions

View file

@ -43,7 +43,6 @@ class ClientDowningNodeThatIsUpSpec
testConductor.enter("all-up")
// mark 'third' node as DOWN
testConductor.removeNode(third)
cluster.down(thirdAddress)
testConductor.enter("down-third-node")
@ -56,6 +55,8 @@ class ClientDowningNodeThatIsUpSpec
cluster.join(node(first).address)
awaitUpConvergence(numberOfMembers = 4)
testConductor.enter("all-up")
testConductor.enter("down-third-node")
testConductor.enter("await-completion")
}
runOn(second, fourth) {

View file

@ -57,7 +57,7 @@ class LeaderDowningNodeThatIsUnreachableSpec
// --- HERE THE LEADER SHOULD DETECT FAILURE AND AUTO-DOWN THE UNREACHABLE NODE ---
awaitUpConvergence(numberOfMembers = 3, canNotBePartOfMemberRing = Seq(fourthAddress), 30.seconds.dilated)
awaitUpConvergence(numberOfMembers = 3, canNotBePartOfMemberRing = Seq(fourthAddress), 30.seconds)
testConductor.enter("await-completion")
}
@ -77,7 +77,7 @@ class LeaderDowningNodeThatIsUnreachableSpec
testConductor.enter("down-fourth-node")
awaitUpConvergence(numberOfMembers = 3, canNotBePartOfMemberRing = Seq(fourthAddress), 30.seconds.dilated)
awaitUpConvergence(numberOfMembers = 3, canNotBePartOfMemberRing = Seq(fourthAddress), 30.seconds)
testConductor.enter("await-completion")
}
}
@ -97,7 +97,7 @@ class LeaderDowningNodeThatIsUnreachableSpec
// --- HERE THE LEADER SHOULD DETECT FAILURE AND AUTO-DOWN THE UNREACHABLE NODE ---
awaitUpConvergence(numberOfMembers = 2, canNotBePartOfMemberRing = Seq(secondAddress), 30.seconds.dilated)
awaitUpConvergence(numberOfMembers = 2, canNotBePartOfMemberRing = Seq(secondAddress), 30.seconds)
testConductor.enter("await-completion")
}
@ -108,7 +108,7 @@ class LeaderDowningNodeThatIsUnreachableSpec
testConductor.enter("all-up")
}
runOn(second, third) {
runOn(third) {
cluster.join(node(first).address)
awaitUpConvergence(numberOfMembers = 3)

View file

@ -60,14 +60,15 @@ trait MultiNodeClusterSpec { self: MultiNodeSpec ⇒
def awaitUpConvergence(
numberOfMembers: Int,
canNotBePartOfMemberRing: Seq[Address] = Seq.empty[Address],
timeout: Duration = 10.seconds.dilated): Unit = {
awaitCond(cluster.latestGossip.members.size == numberOfMembers, timeout)
awaitCond(cluster.latestGossip.members.forall(_.status == MemberStatus.Up), timeout)
awaitCond(cluster.convergence.isDefined, timeout)
if (!canNotBePartOfMemberRing.isEmpty) // don't run this on an empty set
awaitCond(
canNotBePartOfMemberRing forall (address !(cluster.latestGossip.members exists (_.address == address))),
timeout)
timeout: Duration = 20.seconds): Unit = {
within(timeout) {
awaitCond(cluster.latestGossip.members.size == numberOfMembers)
awaitCond(cluster.latestGossip.members.forall(_.status == MemberStatus.Up))
awaitCond(cluster.convergence.isDefined)
if (!canNotBePartOfMemberRing.isEmpty) // don't run this on an empty set
awaitCond(
canNotBePartOfMemberRing forall (address !(cluster.latestGossip.members exists (_.address == address))))
}
}
def roleOfLeader(nodesInCluster: Seq[RoleName]): RoleName = {

View file

@ -37,7 +37,7 @@ abstract class NodeMembershipSpec extends MultiNodeSpec(NodeMembershipMultiJvmSp
"A set of connected cluster systems" must {
"(when two systems) start gossiping to each other so that both systems gets the same gossip info" taggedAs LongRunningTest in {
"(when two nodes) start gossiping to each other so that both nodes gets the same gossip info" taggedAs LongRunningTest in {
// make sure that the node-to-join is started before other join
runOn(first) {
@ -57,7 +57,7 @@ abstract class NodeMembershipSpec extends MultiNodeSpec(NodeMembershipMultiJvmSp
}
"(when three systems) start gossiping to each other so that both systems gets the same gossip info" taggedAs LongRunningTest in {
"(when three nodes) start gossiping to each other so that all nodes gets the same gossip info" taggedAs LongRunningTest in {
runOn(third) {
cluster.join(firstAddress)