Skip to content

Commit

Permalink
adjust route timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrp committed Feb 25, 2025
1 parent bdbe076 commit ff2299c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package pl.touk.nussknacker.test.base.it

import org.apache.pekko.http.scaladsl.model.{ContentTypes, HttpEntity, StatusCode, StatusCodes}
import org.apache.pekko.http.scaladsl.server.{Directives, Route}
import org.apache.pekko.http.scaladsl.testkit.ScalatestRouteTest
import org.apache.pekko.http.scaladsl.testkit.{RouteTestTimeout, ScalatestRouteTest}
import org.apache.pekko.http.scaladsl.unmarshalling.FromEntityUnmarshaller
import cats.effect.IO
import cats.effect.unsafe.implicits.global
Expand All @@ -13,6 +13,7 @@ import com.github.pjfanning.pekkohttpcirce.FailFastCirceSupport
import io.circe.syntax._
import io.circe.{Decoder, Encoder, Json, parser}
import io.dropwizard.metrics5.MetricRegistry
import org.apache.pekko.testkit.TestDuration
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.matchers.should.Matchers
import org.scalatest.{Assertion, BeforeAndAfterEach, OptionValues, Suite}
Expand Down Expand Up @@ -67,6 +68,7 @@ import slick.dbio.DBIOAction

import java.net.URI
import java.time.Clock
import scala.concurrent.duration.DurationInt
import scala.concurrent.{ExecutionContext, Future}

// TODO: Consider using NuItTest with NuScenarioConfigurationHelper instead. This one will be removed in the future.
Expand Down Expand Up @@ -432,6 +434,8 @@ trait NuResourcesTest
)

protected def testScenario(scenario: CanonicalProcess, testDataContent: String): RouteTestResult = {
implicit val timeout: RouteTestTimeout = RouteTestTimeout(10.seconds.dilated)

val scenarioGraph = CanonicalProcessConverter.toScenarioGraph(scenario)
val multiPart = MultipartUtils.prepareMultiParts(
"testData" -> testDataContent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package pl.touk.nussknacker.ui.api

import org.apache.pekko.http.scaladsl.model.{ContentTypeRange, ContentTypes, HttpEntity, StatusCodes}
import org.apache.pekko.http.scaladsl.server.Route
import org.apache.pekko.http.scaladsl.testkit.ScalatestRouteTest
import org.apache.pekko.http.scaladsl.testkit.{RouteTestTimeout, ScalatestRouteTest}
import org.apache.pekko.http.scaladsl.unmarshalling.{FromEntityUnmarshaller, Unmarshaller}
import com.github.pjfanning.pekkohttpcirce.FailFastCirceSupport
import io.circe.syntax._
import org.apache.pekko.testkit.TestDuration
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers
import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach, Inside, OptionValues}
Expand All @@ -21,6 +22,8 @@ import pl.touk.nussknacker.test.utils.domain.ProcessTestData
import pl.touk.nussknacker.ui.process.marshall.CanonicalProcessConverter
import pl.touk.nussknacker.ui.util.MultipartUtils

import scala.concurrent.duration.DurationInt

class ProcessesExportImportResourcesSpec
extends AnyFunSuite
with ScalatestRouteTest
Expand All @@ -35,6 +38,8 @@ class ProcessesExportImportResourcesSpec

import org.apache.pekko.http.scaladsl.server.RouteConcatenation._

private implicit val timeout: RouteTestTimeout = RouteTestTimeout(5.seconds.dilated)

private implicit final val string: FromEntityUnmarshaller[String] =
Unmarshaller.stringUnmarshaller.forContentTypes(ContentTypeRange.*)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import cats.data.OptionT
import cats.instances.all._
import com.typesafe.config.{Config, ConfigValueFactory}
import com.github.pjfanning.pekkohttpcirce.FailFastCirceSupport
import org.apache.pekko.testkit.TestDuration
import org.scalatest.LoneElement._
import org.scalatest._
import org.scalatest.funsuite.AnyFunSuite
Expand Down Expand Up @@ -105,7 +106,7 @@ class ProcessesResourcesSpec
private val fragmentName = ProcessName("fragment")
private val archivedFragmentName = ProcessName("archived-fragment")

private implicit val timeout: RouteTestTimeout = RouteTestTimeout(5.seconds)
private implicit val timeout: RouteTestTimeout = RouteTestTimeout(5.seconds.dilated)

override def designerConfig: Config = super.designerConfig
.withValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.apache.pekko.http.scaladsl.server.{Directives, Route}
import org.apache.pekko.http.scaladsl.testkit.{RouteTestTimeout, ScalatestRouteTest}
import com.typesafe.config.ConfigFactory
import com.github.pjfanning.pekkohttpcirce.FailFastCirceSupport
import org.apache.pekko.testkit.TestDuration
import org.scalatest.OptionValues
import org.scalatest.funspec.AnyFunSpec
import org.scalatest.matchers.should.Matchers
Expand Down Expand Up @@ -36,7 +37,7 @@ class JwtTokenAuthenticationSpec
private val userinfoUri = Uri(URI.create("http://authorization.server/userinfo"))
private val audience = "http://nussknacker"

implicit val timeout: RouteTestTimeout = RouteTestTimeout(5 seconds)
implicit val timeout: RouteTestTimeout = RouteTestTimeout(5.seconds.dilated)

private val config = ConfigFactory.parseString(s"""authentication: {
| method: "OAuth2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.apache.pekko.http.scaladsl.server.{Directives, Route}
import org.apache.pekko.http.scaladsl.testkit.{RouteTestTimeout, ScalatestRouteTest}
import com.typesafe.config.ConfigFactory
import com.github.pjfanning.pekkohttpcirce.FailFastCirceSupport
import org.apache.pekko.testkit.TestDuration
import org.scalatest.OptionValues
import org.scalatest.funspec.AnyFunSpec
import org.scalatest.matchers.should.Matchers
Expand Down Expand Up @@ -34,7 +35,7 @@ class GenericOidcTokenAuthenticationSpec
private val userinfoUri = Uri(URI.create("http://authorization.server/userinfo"))
private val audience = "http://nussknacker"

implicit val timeout: RouteTestTimeout = RouteTestTimeout(5 seconds)
implicit val timeout: RouteTestTimeout = RouteTestTimeout(5.seconds.dilated)

private val roleClaim = "http://namespace/roles"

Expand Down

0 comments on commit ff2299c

Please sign in to comment.