Use configuration property for timeout for assertAllStagesStopped #26410
This commit is contained in:
parent
210394e9de
commit
26b234e9df
2 changed files with 8 additions and 1 deletions
3
akka-stream-testkit/src/main/resources/reference.conf
Normal file
3
akka-stream-testkit/src/main/resources/reference.conf
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
akka.stream.testkit {
|
||||
all-stages-stopped-timeout = 5 s
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue