initialParticipants default as roles.size in cluster tests
This commit is contained in:
parent
6a380550f9
commit
56735477b8
22 changed files with 13 additions and 46 deletions
|
|
@ -29,8 +29,6 @@ class ClientDowningNodeThatIsUnreachableSpec
|
|||
|
||||
import ClientDowningNodeThatIsUnreachableMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 4
|
||||
|
||||
"Client of a 4 node cluster" must {
|
||||
|
||||
"be able to DOWN a node that is UNREACHABLE (killed)" taggedAs LongRunningTest in {
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@ class ClientDowningNodeThatIsUpSpec
|
|||
|
||||
import ClientDowningNodeThatIsUpMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 4
|
||||
|
||||
"Client of a 4 node cluster" must {
|
||||
|
||||
"be able to DOWN a node that is UP (healthy and available)" taggedAs LongRunningTest in {
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ abstract class ConvergenceSpec
|
|||
with MultiNodeClusterSpec {
|
||||
import ConvergenceMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 4
|
||||
|
||||
"A cluster of 3 members" must {
|
||||
|
||||
"reach initial convergence" taggedAs LongRunningTest in {
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@ abstract class GossipingAccrualFailureDetectorSpec extends MultiNodeSpec(Gossipi
|
|||
with MultiNodeClusterSpec {
|
||||
import GossipingAccrualFailureDetectorMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 3
|
||||
|
||||
lazy val firstAddress = node(first).address
|
||||
lazy val secondAddress = node(second).address
|
||||
lazy val thirdAddress = node(third).address
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ abstract class JoinTwoClustersSpec
|
|||
|
||||
import JoinTwoClustersMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 6
|
||||
|
||||
lazy val a1Address = node(a1).address
|
||||
lazy val b1Address = node(b1).address
|
||||
lazy val c1Address = node(c1).address
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ class LeaderDowningNodeThatIsUnreachableSpec
|
|||
|
||||
import LeaderDowningNodeThatIsUnreachableMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 4
|
||||
|
||||
"The Leader in a 4 node cluster" must {
|
||||
|
||||
"be able to DOWN a 'last' node that is UNREACHABLE" taggedAs LongRunningTest in {
|
||||
|
|
|
|||
|
|
@ -31,10 +31,8 @@ abstract class LeaderElectionSpec
|
|||
|
||||
import LeaderElectionMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 5
|
||||
|
||||
// sorted in the order used by the cluster
|
||||
lazy val roles = Seq(first, second, third, fourth).sorted
|
||||
lazy val sortedRoles = Seq(first, second, third, fourth).sorted
|
||||
|
||||
"A cluster of four nodes" must {
|
||||
|
||||
|
|
@ -42,15 +40,15 @@ abstract class LeaderElectionSpec
|
|||
awaitClusterUp(first, second, third, fourth)
|
||||
|
||||
if (myself != controller) {
|
||||
cluster.isLeader must be(myself == roles.head)
|
||||
assertLeaderIn(roles)
|
||||
cluster.isLeader must be(myself == sortedRoles.head)
|
||||
assertLeaderIn(sortedRoles)
|
||||
}
|
||||
|
||||
testConductor.enter("after")
|
||||
}
|
||||
|
||||
def shutdownLeaderAndVerifyNewLeader(alreadyShutdown: Int): Unit = {
|
||||
val currentRoles = roles.drop(alreadyShutdown)
|
||||
val currentRoles = sortedRoles.drop(alreadyShutdown)
|
||||
currentRoles.size must be >= (2)
|
||||
val leader = currentRoles.head
|
||||
val aUser = currentRoles.last
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ abstract class MembershipChangeListenerExitingSpec
|
|||
|
||||
import MembershipChangeListenerExitingMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 3
|
||||
|
||||
lazy val firstAddress = node(first).address
|
||||
lazy val secondAddress = node(second).address
|
||||
lazy val thirdAddress = node(third).address
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ abstract class MembershipChangeListenerJoinSpec
|
|||
|
||||
import MembershipChangeListenerJoinMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 2
|
||||
|
||||
lazy val firstAddress = node(first).address
|
||||
lazy val secondAddress = node(second).address
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ abstract class MembershipChangeListenerLeavingSpec
|
|||
|
||||
import MembershipChangeListenerLeavingMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 3
|
||||
|
||||
lazy val firstAddress = node(first).address
|
||||
lazy val secondAddress = node(second).address
|
||||
lazy val thirdAddress = node(third).address
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ abstract class MembershipChangeListenerSpec extends MultiNodeSpec(MembershipChan
|
|||
with MultiNodeClusterSpec {
|
||||
import MembershipChangeListenerMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 3
|
||||
|
||||
lazy val firstAddress = node(first).address
|
||||
lazy val secondAddress = node(second).address
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@ abstract class MembershipChangeListenerUpSpec
|
|||
|
||||
import MembershipChangeListenerUpMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 2
|
||||
|
||||
lazy val firstAddress = node(first).address
|
||||
lazy val secondAddress = node(second).address
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ object MultiNodeClusterSpec {
|
|||
|
||||
trait MultiNodeClusterSpec { self: MultiNodeSpec ⇒
|
||||
|
||||
override def initialParticipants = roles.size
|
||||
|
||||
/**
|
||||
* Get or create a cluster node using 'Cluster(system)' extension.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ abstract class NodeJoinSpec
|
|||
|
||||
import NodeJoinMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 2
|
||||
|
||||
lazy val firstAddress = node(first).address
|
||||
lazy val secondAddress = node(second).address
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@ abstract class NodeLeavingAndExitingAndBeingRemovedSpec
|
|||
|
||||
import NodeLeavingAndExitingAndBeingRemovedMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 3
|
||||
|
||||
lazy val firstAddress = node(first).address
|
||||
lazy val secondAddress = node(second).address
|
||||
lazy val thirdAddress = node(third).address
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@ abstract class NodeLeavingAndExitingSpec
|
|||
|
||||
import NodeLeavingAndExitingMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 3
|
||||
|
||||
lazy val firstAddress = node(first).address
|
||||
lazy val secondAddress = node(second).address
|
||||
lazy val thirdAddress = node(third).address
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@ abstract class NodeLeavingSpec extends MultiNodeSpec(NodeLeavingMultiJvmSpec)
|
|||
with MultiNodeClusterSpec {
|
||||
import NodeLeavingMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 3
|
||||
|
||||
lazy val firstAddress = node(first).address
|
||||
lazy val secondAddress = node(second).address
|
||||
lazy val thirdAddress = node(third).address
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@ abstract class NodeMembershipSpec
|
|||
|
||||
import NodeMembershipMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 3
|
||||
|
||||
lazy val firstAddress = node(first).address
|
||||
lazy val secondAddress = node(second).address
|
||||
lazy val thirdAddress = node(third).address
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@ class NodeShutdownMultiJvmNode2 extends NodeShutdownSpec
|
|||
abstract class NodeShutdownSpec extends MultiNodeSpec(NodeShutdownMultiJvmSpec) with MultiNodeClusterSpec {
|
||||
import NodeShutdownMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 2
|
||||
|
||||
"A cluster of 2 nodes" must {
|
||||
|
||||
"not be singleton cluster when joined" taggedAs LongRunningTest in {
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@ abstract class NodeUpSpec
|
|||
|
||||
import NodeUpMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = 2
|
||||
|
||||
"A cluster node that is joining another cluster" must {
|
||||
"be moved to UP by the leader after a convergence" taggedAs LongRunningTest in {
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,6 @@ abstract class SunnyWeatherSpec
|
|||
|
||||
import SunnyWeatherMultiJvmSpec._
|
||||
|
||||
override def initialParticipants = roles.size
|
||||
|
||||
"A normal cluster" must {
|
||||
"be healthy" taggedAs LongRunningTest in {
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ abstract class MultiNodeConfig {
|
|||
|
||||
private[testkit] def deployments(node: RoleName): Seq[String] = (_deployments get node getOrElse Nil) ++ _allDeploy
|
||||
|
||||
def roles: Seq[RoleName] = _roles
|
||||
private[testkit] def roles: Seq[RoleName] = _roles
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ object MultiNodeSpec {
|
|||
* `AskTimeoutException: sending to terminated ref breaks promises`. Using lazy
|
||||
* val is fine.
|
||||
*/
|
||||
abstract class MultiNodeSpec(val myself: RoleName, _system: ActorSystem, roles: Seq[RoleName], deployments: RoleName ⇒ Seq[String])
|
||||
abstract class MultiNodeSpec(val myself: RoleName, _system: ActorSystem, _roles: Seq[RoleName], deployments: RoleName ⇒ Seq[String])
|
||||
extends AkkaSpec(_system) {
|
||||
|
||||
import MultiNodeSpec._
|
||||
|
|
@ -143,6 +143,11 @@ abstract class MultiNodeSpec(val myself: RoleName, _system: ActorSystem, roles:
|
|||
* Test Class Interface
|
||||
*/
|
||||
|
||||
/**
|
||||
* All registered roles
|
||||
*/
|
||||
def roles: Seq[RoleName] = _roles
|
||||
|
||||
/**
|
||||
* TO BE DEFINED BY USER: Defines the number of participants required for starting the test. This
|
||||
* might not be equals to the number of nodes available to the test.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue