Skip to content

Commit

Permalink
Allows resource startup timeout to be configured
Browse files Browse the repository at this point in the history
Configurable by a new system property
  • Loading branch information
mcgizzle committed Feb 25, 2022
1 parent 7fe40e2 commit b0f0894
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/framework/src-jvm/RunnerCompat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import java.util.concurrent.atomic.{ AtomicBoolean, AtomicInteger }

import scala.concurrent.duration._
import scala.concurrent.{ ExecutionContext, Promise }
import scala.util.Try

import cats.data.Chain
import cats.effect.{ Sync, _ }
Expand Down Expand Up @@ -119,9 +120,10 @@ trait RunnerCompat[F[_]] { self: sbt.testing.Runner =>
gate)
stillRunning.set(sbtTasks.size)

val maybeTimeout = Try(System.getProperty("weaver.test.startupTimeout")).toOption.flatMap(Option(_))
// Waiting for the resources to be allocated.
scala.concurrent.blocking {
scala.concurrent.Await.result(gate.future, 120.second)
scala.concurrent.Await.result(gate.future, maybeTimeout.getOrElse(120.second))
}
sbtTasks.toArray
}
Expand Down

0 comments on commit b0f0894

Please sign in to comment.