Refactor cluster startup join in tests and fix barrier race

* Refactored common code to MultiNodeClusterSpec.awaitClusterUp
* Fixed some race conditions of barriers
This commit is contained in:
Patrik Nordwall 2012-06-05 14:13:44 +02:00
parent 5ccfb2cfee
commit f02793ebd6
18 changed files with 85 additions and 208 deletions

View file

@ -34,13 +34,10 @@ class ClientDowningNodeThatIsUnreachableSpec
"Client of a 4 node cluster" must {
"be able to DOWN a node that is UNREACHABLE (killed)" taggedAs LongRunningTest in {
val thirdAddress = node(third).address
awaitClusterUp(first, second, third, fourth)
runOn(first) {
startClusterNode()
awaitUpConvergence(numberOfMembers = 4)
val thirdAddress = node(third).address
testConductor.enter("all-up")
// kill 'third' node
testConductor.shutdown(third, 0)
@ -50,28 +47,19 @@ class ClientDowningNodeThatIsUnreachableSpec
awaitUpConvergence(numberOfMembers = 3, canNotBePartOfMemberRing = Seq(thirdAddress))
cluster.latestGossip.members.exists(_.address == thirdAddress) must be(false)
testConductor.enter("await-completion")
}
runOn(third) {
cluster.join(node(first).address)
awaitUpConvergence(numberOfMembers = 4)
testConductor.enter("all-up")
testConductor.enter("down-third-node")
}
runOn(second, fourth) {
cluster.join(node(first).address)
awaitUpConvergence(numberOfMembers = 4)
val thirdAddress = node(third).address
testConductor.enter("all-up")
testConductor.enter("down-third-node")
awaitUpConvergence(numberOfMembers = 3, canNotBePartOfMemberRing = Seq(thirdAddress))
testConductor.enter("await-completion")
}
testConductor.enter("await-completion")
}
}
}