Merge pull request #17402 from akka/wip-17002-ActorSystemSpec-patriknw
=act #17002 Harden ActorSystemSpec
This commit is contained in:
commit
ee1cb711f9
1 changed files with 2 additions and 1 deletions
|
|
@ -288,7 +288,7 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend
|
||||||
"reliable deny creation of actors while shutting down" in {
|
"reliable deny creation of actors while shutting down" in {
|
||||||
val system = ActorSystem()
|
val system = ActorSystem()
|
||||||
import system.dispatcher
|
import system.dispatcher
|
||||||
system.scheduler.scheduleOnce(200 millis) { system.terminate() }
|
system.scheduler.scheduleOnce(100 millis) { system.terminate() }
|
||||||
var failing = false
|
var failing = false
|
||||||
var created = Vector.empty[ActorRef]
|
var created = Vector.empty[ActorRef]
|
||||||
while (!system.whenTerminated.isCompleted) {
|
while (!system.whenTerminated.isCompleted) {
|
||||||
|
|
@ -296,6 +296,7 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend
|
||||||
val t = system.actorOf(Props[ActorSystemSpec.Terminater])
|
val t = system.actorOf(Props[ActorSystemSpec.Terminater])
|
||||||
failing should not be true // because once failing => always failing (it’s due to shutdown)
|
failing should not be true // because once failing => always failing (it’s due to shutdown)
|
||||||
created :+= t
|
created :+= t
|
||||||
|
if (created.size % 1000 == 0) Thread.sleep(20) // in case of unfair thread scheduling
|
||||||
} catch {
|
} catch {
|
||||||
case _: IllegalStateException ⇒ failing = true
|
case _: IllegalStateException ⇒ failing = true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue