diff --git a/akka-stream-testkit/src/main/resources/reference.conf b/akka-stream-testkit/src/main/resources/reference.conf new file mode 100644 index 0000000000..7a99c683ad --- /dev/null +++ b/akka-stream-testkit/src/main/resources/reference.conf @@ -0,0 +1,3 @@ +akka.stream.testkit { + all-stages-stopped-timeout = 5 s +} diff --git a/akka-stream-testkit/src/main/scala/akka/stream/testkit/scaladsl/StreamTestKit.scala b/akka-stream-testkit/src/main/scala/akka/stream/testkit/scaladsl/StreamTestKit.scala index 17912fc335..8092aef841 100644 --- a/akka-stream-testkit/src/main/scala/akka/stream/testkit/scaladsl/StreamTestKit.scala +++ b/akka-stream-testkit/src/main/scala/akka/stream/testkit/scaladsl/StreamTestKit.scala @@ -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