diff --git a/akka-guard-core-typed/src/test/scala/com/chatwork/akka/guard/typed/SABBrokerSpec.scala b/akka-guard-core-typed/src/test/scala/com/chatwork/akka/guard/typed/SABBrokerSpec.scala index dd5026b..5820749 100644 --- a/akka-guard-core-typed/src/test/scala/com/chatwork/akka/guard/typed/SABBrokerSpec.scala +++ b/akka-guard-core-typed/src/test/scala/com/chatwork/akka/guard/typed/SABBrokerSpec.scala @@ -32,8 +32,8 @@ class SABBrokerSpec implicit override val patienceConfig: PatienceConfig = PatienceConfig( - timeout = scaled(Span(30 * testTimeFactor, Seconds)), - interval = scaled(Span(2 * testTimeFactor, Millis)) + timeout = scaled(Span(3 * testTimeFactor, Seconds)), + interval = scaled(Span(1 * testTimeFactor, Millis)) ) override protected def afterAll(): Unit = { diff --git a/akka-guard-core-typed/src/test/scala/com/chatwork/akka/guard/typed/SABExponentialSpec.scala b/akka-guard-core-typed/src/test/scala/com/chatwork/akka/guard/typed/SABExponentialSpec.scala index 8fd891c..681b2dc 100644 --- a/akka-guard-core-typed/src/test/scala/com/chatwork/akka/guard/typed/SABExponentialSpec.scala +++ b/akka-guard-core-typed/src/test/scala/com/chatwork/akka/guard/typed/SABExponentialSpec.scala @@ -34,8 +34,8 @@ class SABExponentialSpec implicit override val patienceConfig: PatienceConfig = PatienceConfig( - timeout = scaled(Span(30 * testTimeFactor, Seconds)), - interval = scaled(Span(2 * testTimeFactor, Millis)) + timeout = scaled(Span(3 * testTimeFactor, Seconds)), + interval = scaled(Span(1 * testTimeFactor, Millis)) ) override protected def afterAll(): Unit = { diff --git a/akka-guard-core-typed/src/test/scala/com/chatwork/akka/guard/typed/SABReceiveTimeoutSpec.scala b/akka-guard-core-typed/src/test/scala/com/chatwork/akka/guard/typed/SABReceiveTimeoutSpec.scala index 7e9aeda..087a628 100644 --- a/akka-guard-core-typed/src/test/scala/com/chatwork/akka/guard/typed/SABReceiveTimeoutSpec.scala +++ b/akka-guard-core-typed/src/test/scala/com/chatwork/akka/guard/typed/SABReceiveTimeoutSpec.scala @@ -31,8 +31,8 @@ class SABReceiveTimeoutSpec implicit override val patienceConfig: PatienceConfig = PatienceConfig( - timeout = scaled(Span(30 * testTimeFactor, Seconds)), - interval = scaled(Span(2 * testTimeFactor, Millis)) + timeout = scaled(Span(3 * testTimeFactor, Seconds)), + interval = scaled(Span(1 * testTimeFactor, Millis)) ) override protected def afterAll(): Unit = { diff --git a/akka-guard-core/src/test/scala/com/chatwork/akka/guard/SABBrokerSpec.scala b/akka-guard-core/src/test/scala/com/chatwork/akka/guard/SABBrokerSpec.scala index f9b5a33..fbe7fab 100644 --- a/akka-guard-core/src/test/scala/com/chatwork/akka/guard/SABBrokerSpec.scala +++ b/akka-guard-core/src/test/scala/com/chatwork/akka/guard/SABBrokerSpec.scala @@ -39,8 +39,8 @@ class SABBrokerSpec implicit override val patienceConfig: PatienceConfig = PatienceConfig( - timeout = scaled(Span(30 * testTimeFactor, Seconds)), - interval = scaled(Span(5 * testTimeFactor, Millis)) + timeout = scaled(Span(3 * testTimeFactor, Seconds)), + interval = scaled(Span(1 * testTimeFactor, Millis)) ) Feature("SABBrokerSpec untyped") { @@ -62,7 +62,7 @@ class SABBrokerSpec } val sabBroker: ActorRef = system.actorOf(Props(new SABBroker(config, failedResponse, isFailed)), sabBrokerName1) val messagePath: ActorPath = system / sabBrokerName1 / SABSupervisor.name(messageId) / SABActor.name(messageId) - val messageRef: ActorSelection = system.actorSelection(messagePath) + def messageRef: ActorSelection = system.actorSelection(messagePath) When("Long input") Then("return success message") diff --git a/akka-guard-core/src/test/scala/com/chatwork/akka/guard/SABExponentialSpec.scala b/akka-guard-core/src/test/scala/com/chatwork/akka/guard/SABExponentialSpec.scala index e427219..d0860a5 100644 --- a/akka-guard-core/src/test/scala/com/chatwork/akka/guard/SABExponentialSpec.scala +++ b/akka-guard-core/src/test/scala/com/chatwork/akka/guard/SABExponentialSpec.scala @@ -36,8 +36,8 @@ class SABExponentialSpec implicit override val patienceConfig: PatienceConfig = PatienceConfig( - timeout = scaled(Span(30 * testTimeFactor, Seconds)), - interval = scaled(Span(2 * testTimeFactor, Millis)) + timeout = scaled(Span(3 * testTimeFactor, Seconds)), + interval = scaled(Span(1 * testTimeFactor, Millis)) ) "SABExponential untyped" - { @@ -100,7 +100,7 @@ class SABExponentialSpec sabBrokerName1 ) val messagePath: ActorPath = system / sabBrokerName1 / SABSupervisor.name(messageId) / SABActor.name(messageId) - val messageRef: ActorSelection = system.actorSelection(messagePath) + def messageRef: ActorSelection = system.actorSelection(messagePath) val message1 = SABMessage(messageId, "A" * 50, handler) (sabBroker ? message1).mapTo[String].futureValue shouldBe successMessage diff --git a/akka-guard-core/src/test/scala/com/chatwork/akka/guard/SABReceiveTimeoutSpec.scala b/akka-guard-core/src/test/scala/com/chatwork/akka/guard/SABReceiveTimeoutSpec.scala index 3bb41a9..67d4db0 100644 --- a/akka-guard-core/src/test/scala/com/chatwork/akka/guard/SABReceiveTimeoutSpec.scala +++ b/akka-guard-core/src/test/scala/com/chatwork/akka/guard/SABReceiveTimeoutSpec.scala @@ -65,7 +65,7 @@ class SABReceiveTimeoutSpec } val sabBroker: ActorRef = system.actorOf(Props(new SABBroker(config, failedResponse, isFailed)), sabBrokerName1) val messagePath: ActorPath = system / sabBrokerName1 / SABSupervisor.name(messageId) / SABActor.name(messageId) - val messageRef: ActorSelection = system.actorSelection(messagePath) + def messageRef: ActorSelection = system.actorSelection(messagePath) val message1 = SABMessage(messageId, "A" * BoundaryLength, handler) (sabBroker ? message1).mapTo[String].futureValue shouldBe successMessage diff --git a/akka-guard-http-typed/src/test/scala/com/chatwork/akka/guard/http/typed/ServiceAttackBlockerDirectivesSpec.scala b/akka-guard-http-typed/src/test/scala/com/chatwork/akka/guard/http/typed/ServiceAttackBlockerDirectivesSpec.scala index 9ae9e95..7d0f9e6 100644 --- a/akka-guard-http-typed/src/test/scala/com/chatwork/akka/guard/http/typed/ServiceAttackBlockerDirectivesSpec.scala +++ b/akka-guard-http-typed/src/test/scala/com/chatwork/akka/guard/http/typed/ServiceAttackBlockerDirectivesSpec.scala @@ -35,8 +35,8 @@ class ServiceAttackBlockerDirectivesSpec implicit override val patienceConfig: PatienceConfig = PatienceConfig( - timeout = scaled(Span(30 * testTimeFactor, Seconds)), - interval = scaled(Span(2 * testTimeFactor, Millis)) + timeout = scaled(Span(3 * testTimeFactor, Seconds)), + interval = scaled(Span(1 * testTimeFactor, Millis)) ) override protected def afterAll(): Unit = { diff --git a/akka-guard-http/src/test/scala/com/chatwork/akka/guard/http/ServiceAttackBlockerDirectivesSpec.scala b/akka-guard-http/src/test/scala/com/chatwork/akka/guard/http/ServiceAttackBlockerDirectivesSpec.scala index 71a3d51..a64e8d9 100644 --- a/akka-guard-http/src/test/scala/com/chatwork/akka/guard/http/ServiceAttackBlockerDirectivesSpec.scala +++ b/akka-guard-http/src/test/scala/com/chatwork/akka/guard/http/ServiceAttackBlockerDirectivesSpec.scala @@ -12,6 +12,7 @@ import org.scalatest.concurrent.PatienceConfiguration.Timeout import org.scalatest.concurrent.{ Eventually, ScalaFutures } import org.scalatest.freespec.AnyFreeSpec import org.scalatest.matchers.should.Matchers +import org.scalatest.time.{ Millis, Seconds, Span } import scala.concurrent.duration._ import scala.util.{ Success, Try } @@ -25,6 +26,12 @@ class ServiceAttackBlockerDirectivesSpec val testTimeFactor: Int = sys.env.getOrElse("TEST_TIME_FACTOR", "1").toInt + implicit override val patienceConfig: PatienceConfig = + PatienceConfig( + timeout = scaled(Span(3 * testTimeFactor, Seconds)), + interval = scaled(Span(1 * testTimeFactor, Millis)) + ) + implicit val timeout: AkkaTimeout = AkkaTimeout((4 * testTimeFactor).seconds) val clientId = "id-1" val uri: String => String = prefix => s"/$prefix/$clientId"