Use configuration property for timeout for assertAllStagesStopped #26410

This commit is contained in:
Varun Sivapalan 2019-03-11 10:32:37 +01:00 committed by Johan Andrén
parent 210394e9de
commit 26b234e9df
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,3 @@
akka.stream.testkit {
all-stages-stopped-timeout = 5 s
}

View file

@ -4,6 +4,8 @@
package akka.stream.testkit.scaladsl
import java.util.concurrent.TimeUnit.MILLISECONDS
import akka.actor.{ ActorRef, ActorSystem }
import akka.annotation.InternalApi
import akka.stream._
@ -43,7 +45,9 @@ object StreamTestKit {
/** INTERNAL API */
@InternalApi private[testkit] def assertNoChildren(sys: ActorSystem, supervisor: ActorRef): Unit = {
val probe = TestProbe()(sys)
probe.within(5.seconds) {
val c = sys.settings.config.getConfig("akka.stream.testkit")
val timeout = c.getDuration("all-stages-stopped-timeout", MILLISECONDS).millis
probe.within(timeout) {
try probe.awaitAssert {
supervisor.tell(StreamSupervisor.GetChildren, probe.ref)
val children = probe.expectMsgType[StreamSupervisor.Children].children