Test leader member states, see 2157
* The only allowed member states for a leader are up or leaving * Added above check in assertLeader so that we always verify that * More usage of assertLeader in the tests
This commit is contained in:
parent
ab1969e93a
commit
4dbf4a70b3
4 changed files with 15 additions and 5 deletions
|
|
@ -49,6 +49,7 @@ abstract class LeaderElectionSpec extends MultiNodeSpec(LeaderElectionMultiJvmSp
|
|||
cluster.join(firstAddress)
|
||||
awaitUpConvergence(numberOfMembers = roles.size)
|
||||
cluster.isLeader must be(myself == roles.head)
|
||||
assertLeaderIn(roles)
|
||||
}
|
||||
testConductor.enter("after")
|
||||
}
|
||||
|
|
@ -58,6 +59,7 @@ abstract class LeaderElectionSpec extends MultiNodeSpec(LeaderElectionMultiJvmSp
|
|||
currentRoles.size must be >= (2)
|
||||
val leader = currentRoles.head
|
||||
val aUser = currentRoles.last
|
||||
val remainingRoles = currentRoles.tail
|
||||
|
||||
myself match {
|
||||
|
||||
|
|
@ -78,13 +80,14 @@ abstract class LeaderElectionSpec extends MultiNodeSpec(LeaderElectionMultiJvmSp
|
|||
cluster.down(leaderAddress)
|
||||
testConductor.enter("after-down", "completed")
|
||||
|
||||
case _ if currentRoles.tail.contains(myself) ⇒
|
||||
case _ if remainingRoles.contains(myself) ⇒
|
||||
// remaining cluster nodes, not shutdown
|
||||
testConductor.enter("before-shutdown", "after-shutdown", "after-down")
|
||||
|
||||
awaitUpConvergence(currentRoles.size - 1)
|
||||
val nextExpectedLeader = currentRoles.tail.head
|
||||
val nextExpectedLeader = remainingRoles.head
|
||||
cluster.isLeader must be(myself == nextExpectedLeader)
|
||||
assertLeaderIn(remainingRoles)
|
||||
|
||||
testConductor.enter("completed")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue