From cc35563ae962a148584cf22dd224fd780050eb71 Mon Sep 17 00:00:00 2001 From: Adam Warski Date: Thu, 30 Apr 2026 11:19:38 +0000 Subject: [PATCH 1/2] Fix FutureMonadTest flakiness on Scala 2.12 under CI load The test used `intercept[RuntimeException]` around `.futureValue`, but `TestFailedException` (thrown on timeout) is a `RuntimeException` subclass. On a loaded CI machine, the 150ms default patience expired before the finalizer future completed, causing the intercept to silently catch the timeout instead of the expected "boom!" exception. Result: `ran.get` was `false` even though `intercept` appeared to succeed. Fix: mix in `ScalaFutures` to allow a 10s patience override, and use `.failed.futureValue` so a timeout throws `TestFailedException` uncaught rather than being mistaken for the expected exception. Co-Authored-By: Claude Sonnet 4.6 --- .../test/scalajvm/sttp/monad/FutureMonadTest.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/test/scalajvm/sttp/monad/FutureMonadTest.scala b/core/src/test/scalajvm/sttp/monad/FutureMonadTest.scala index 6e58e6a..4ddc9c3 100644 --- a/core/src/test/scalajvm/sttp/monad/FutureMonadTest.scala +++ b/core/src/test/scalajvm/sttp/monad/FutureMonadTest.scala @@ -1,23 +1,23 @@ package sttp.monad -import org.scalatest.concurrent.ScalaFutures.convertScalaFuture +import org.scalatest.concurrent.ScalaFutures import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers +import org.scalatest.time.{Seconds, Span} import java.util.concurrent.atomic.AtomicBoolean import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future -class FutureMonadTest extends AnyFlatSpec with Matchers { +class FutureMonadTest extends AnyFlatSpec with Matchers with ScalaFutures { + implicit override val patienceConfig: PatienceConfig = PatienceConfig(timeout = Span(10, Seconds)) implicit val m: MonadError[Future] = new FutureMonad() it should "ensure" in { val ran = new AtomicBoolean(false) - intercept[RuntimeException] { - m.ensure2((throw new RuntimeException("boom!")): Future[Int], Future(ran.set(true))).futureValue - } - + val result = m.ensure2((throw new RuntimeException("boom!")): Future[Int], Future(ran.set(true))) + result.failed.futureValue shouldBe a[RuntimeException] ran.get shouldBe true } } From e6dffa4bd1bcd6667242ddabab2d9afed14cb62c Mon Sep 17 00:00:00 2001 From: adamw Date: Thu, 30 Apr 2026 16:09:50 +0200 Subject: [PATCH 2/2] Release 1.5.2 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d0320c4..3c48d14 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ sttp is a family of Scala HTTP-related projects, and currently includes: Add the following dependency: ```scala -"com.softwaremill.sttp.shared" %% "core" % "1.5.1" +"com.softwaremill.sttp.shared" %% "core" % "1.5.2" ``` sttp-shared is available for Scala 2.12, 2.13, 3.3, Scala.JS and Scala Native.