!tes #2971 Make TestKit.remaining throw AssertionError outside of within
This commit is contained in:
parent
dfef14a590
commit
826cc74de3
41 changed files with 156 additions and 120 deletions
|
|
@ -236,7 +236,7 @@ abstract class ClusterDeathWatchSpec
|
|||
|
||||
enterBarrier("first-unavailable")
|
||||
|
||||
val timeout = remaining
|
||||
val timeout = remainingOrDefault
|
||||
try system.awaitTermination(timeout) catch {
|
||||
case _: TimeoutException ⇒
|
||||
fail("Failed to stop [%s] within [%s] \n%s".format(system.name, timeout,
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ trait MultiNodeClusterSpec extends Suite with STMultiNodeSpec with WatchedByCoro
|
|||
* Join the specific node within the given period by sending repeated join
|
||||
* requests at periodic intervals until we succeed.
|
||||
*/
|
||||
def joinWithin(joinNode: RoleName, max: Duration = remaining, interval: Duration = 1.second): Unit = {
|
||||
def joinWithin(joinNode: RoleName, max: Duration = remainingOrDefault, interval: Duration = 1.second): Unit = {
|
||||
def memberInState(member: Address, status: Seq[MemberStatus]): Boolean =
|
||||
clusterView.members.exists { m ⇒ (m.address == member) && status.contains(m.status) }
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ abstract class RestartFirstSeedNodeSpec
|
|||
|
||||
// shutdown seed1System
|
||||
runOn(seed1) {
|
||||
shutdown(seed1System, remaining)
|
||||
shutdown(seed1System, remainingOrDefault)
|
||||
}
|
||||
runOn(seed2, seed3) {
|
||||
awaitMembersUp(2, canNotBePartOfMemberRing = Set(seedNodes.head))
|
||||
|
|
|
|||
|
|
@ -802,7 +802,7 @@ abstract class StressSpec
|
|||
clusterResultAggregator match {
|
||||
case Some(r) ⇒
|
||||
watch(r)
|
||||
expectMsgPF(remaining) { case Terminated(a) if a.path == r.path ⇒ true }
|
||||
expectMsgPF() { case Terminated(a) if a.path == r.path ⇒ true }
|
||||
case None ⇒ // ok, already terminated
|
||||
}
|
||||
}
|
||||
|
|
@ -829,7 +829,7 @@ abstract class StressSpec
|
|||
runOn(currentRoles.last) {
|
||||
cluster.join(roles.head)
|
||||
}
|
||||
awaitMembersUp(currentRoles.size, timeout = remaining)
|
||||
awaitMembersUp(currentRoles.size, timeout = remainingOrDefault)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -849,7 +849,7 @@ abstract class StressSpec
|
|||
if (toSeedNodes) cluster.joinSeedNodes(seedNodes.toIndexedSeq map address)
|
||||
else cluster.join(roles.head)
|
||||
}
|
||||
awaitMembersUp(currentRoles.size, timeout = remaining)
|
||||
awaitMembersUp(currentRoles.size, timeout = remainingOrDefault)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -892,14 +892,14 @@ abstract class StressSpec
|
|||
testConductor.exit(removeRole, 0).await
|
||||
}
|
||||
}
|
||||
awaitMembersUp(currentRoles.size, timeout = remaining)
|
||||
awaitMembersUp(currentRoles.size, timeout = remainingOrDefault)
|
||||
awaitAllReachable()
|
||||
}
|
||||
}
|
||||
|
||||
runOn(roles.head) {
|
||||
val expectedPath = RootActorPath(removeAddress) / "user" / "watchee"
|
||||
expectMsgPF(remaining) {
|
||||
expectMsgPF() {
|
||||
case Terminated(a) if a.path == expectedPath ⇒ true
|
||||
}
|
||||
}
|
||||
|
|
@ -927,7 +927,7 @@ abstract class StressSpec
|
|||
testConductor.exit(r, 0).await
|
||||
}
|
||||
}
|
||||
awaitMembersUp(currentRoles.size, timeout = remaining)
|
||||
awaitMembersUp(currentRoles.size, timeout = remainingOrDefault)
|
||||
awaitAllReachable()
|
||||
}
|
||||
}
|
||||
|
|
@ -978,7 +978,7 @@ abstract class StressSpec
|
|||
awaitMembersUp(
|
||||
nbrUsedRoles + activeRoles.size,
|
||||
canNotBePartOfMemberRing = allPreviousAddresses,
|
||||
timeout = remaining)
|
||||
timeout = remainingOrDefault)
|
||||
awaitAllReachable()
|
||||
}
|
||||
val nextAddresses = clusterView.members.map(_.address) -- usedAddresses
|
||||
|
|
@ -1000,7 +1000,7 @@ abstract class StressSpec
|
|||
loop(1, None, Set.empty) foreach { as ⇒ TestKit.shutdownActorSystem(as) }
|
||||
within(loopDuration) {
|
||||
runOn(usedRoles: _*) {
|
||||
awaitMembersUp(nbrUsedRoles, timeout = remaining)
|
||||
awaitMembersUp(nbrUsedRoles, timeout = remainingOrDefault)
|
||||
awaitAllReachable()
|
||||
phiObserver ! Reset
|
||||
statsObserver ! Reset
|
||||
|
|
@ -1142,7 +1142,7 @@ abstract class StressSpec
|
|||
runOn((seedNodes ++ otherNodesJoiningSeedNodes): _*) {
|
||||
reportResult {
|
||||
cluster.joinSeedNodes(seedNodes.toIndexedSeq map address)
|
||||
awaitMembersUp(size, timeout = remaining)
|
||||
awaitMembersUp(size, timeout = remainingOrDefault)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa
|
|||
import AdaptiveLoadBalancingRouterMultiJvmSpec._
|
||||
|
||||
def currentRoutees(router: ActorRef) =
|
||||
Await.result(router ? CurrentRoutees, remaining).asInstanceOf[RouterRoutees].routees
|
||||
Await.result(router ? CurrentRoutees, timeout.duration).asInstanceOf[RouterRoutees].routees
|
||||
|
||||
def receiveReplies(expectedReplies: Int): Map[Address, Int] = {
|
||||
val zero = Map.empty[Address, Int] ++ roles.map(address(_) -> 0)
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ abstract class ClusterConsistentHashingRouterSpec extends MultiNodeSpec(ClusterC
|
|||
lazy val router1 = system.actorOf(Props[Echo].withRouter(FromConfig()), "router1")
|
||||
|
||||
def currentRoutees(router: ActorRef) =
|
||||
Await.result(router ? CurrentRoutees, remaining).asInstanceOf[RouterRoutees].routees
|
||||
Await.result(router ? CurrentRoutees, timeout.duration).asInstanceOf[RouterRoutees].routees
|
||||
|
||||
/**
|
||||
* Fills in self address for local ActorRef
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou
|
|||
}
|
||||
|
||||
def currentRoutees(router: ActorRef) =
|
||||
Await.result(router ? CurrentRoutees, remaining).asInstanceOf[RouterRoutees].routees
|
||||
Await.result(router ? CurrentRoutees, timeout.duration).asInstanceOf[RouterRoutees].routees
|
||||
|
||||
"A cluster router with a RoundRobin router" must {
|
||||
"start cluster with 2 nodes" taggedAs LongRunningTest in {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa
|
|||
import AdaptiveLoadBalancingRouterMultiJvmSpec._
|
||||
|
||||
def currentRoutees(router: ActorRef) =
|
||||
Await.result(router ? GetRoutees, remaining).asInstanceOf[Routees].routees
|
||||
Await.result(router ? GetRoutees, timeout.duration).asInstanceOf[Routees].routees
|
||||
|
||||
def receiveReplies(expectedReplies: Int): Map[Address, Int] = {
|
||||
val zero = Map.empty[Address, Int] ++ roles.map(address(_) -> 0)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ abstract class ClusterConsistentHashingGroupSpec extends MultiNodeSpec(ClusterCo
|
|||
}
|
||||
|
||||
def currentRoutees(router: ActorRef) =
|
||||
Await.result(router ? GetRoutees, remaining).asInstanceOf[Routees].routees
|
||||
Await.result(router ? GetRoutees, timeout.duration).asInstanceOf[Routees].routees
|
||||
|
||||
"A cluster router with a consistent hashing group" must {
|
||||
"start cluster with 3 nodes" taggedAs LongRunningTest in {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ abstract class ClusterConsistentHashingRouterSpec extends MultiNodeSpec(ClusterC
|
|||
lazy val router1 = system.actorOf(FromConfig.props(Props[Echo]), "router1")
|
||||
|
||||
def currentRoutees(router: ActorRef) =
|
||||
Await.result(router ? GetRoutees, remaining).asInstanceOf[Routees].routees
|
||||
Await.result(router ? GetRoutees, timeout.duration).asInstanceOf[Routees].routees
|
||||
|
||||
/**
|
||||
* Fills in self address for local ActorRef
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult
|
|||
}
|
||||
|
||||
def currentRoutees(router: ActorRef) =
|
||||
Await.result(router ? GetRoutees, remaining).asInstanceOf[Routees].routees
|
||||
Await.result(router ? GetRoutees, timeout.duration).asInstanceOf[Routees].routees
|
||||
|
||||
"A cluster router with a RoundRobin router" must {
|
||||
"start cluster with 2 nodes" taggedAs LongRunningTest in {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue