Merge pull request #17402 from akka/wip-17002-ActorSystemSpec-patriknw

=act #17002 Harden ActorSystemSpec
This commit is contained in:
Patrik Nordwall 2015-05-07 11:06:20 +02:00
commit ee1cb711f9

View file

@ -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 (its due to shutdown) failing should not be true // because once failing => always failing (its 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
} }