From f33c63bee7ad8074d8c3d65d07c44398fcb67ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Kleinb=C3=B6lting?= Date: Thu, 19 Dec 2024 11:24:14 +0100 Subject: [PATCH] Revert upgrade of wiremock due to bug in 3.10.0 bug report: https://github.com/wiremock/wiremock/issues/2911 --- project/Dependencies.scala | 4 +++- .../domain/service/DspIngestClientLiveSpec.scala | 13 ++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 6d4a2ea545..e99bd50243 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -122,7 +122,9 @@ object Dependencies { val scalaTest = "org.scalatest" %% "scalatest" % "3.2.19" val testcontainers = "org.testcontainers" % "testcontainers" % "1.20.4" - val wiremock = "org.wiremock" % "wiremock" % "3.10.0" + + // use version 3.9.2 until https://github.com/wiremock/wiremock/issues/2911 is fixed + val wiremock = "org.wiremock" % "wiremock" % "3.9.2" // found/added by the plugin but deleted anyway val commonsLang3 = "org.apache.commons" % "commons-lang3" % "3.17.0" diff --git a/webapi/src/test/scala/org/knora/webapi/slice/admin/domain/service/DspIngestClientLiveSpec.scala b/webapi/src/test/scala/org/knora/webapi/slice/admin/domain/service/DspIngestClientLiveSpec.scala index 70f73df5f4..f801536b1e 100644 --- a/webapi/src/test/scala/org/knora/webapi/slice/admin/domain/service/DspIngestClientLiveSpec.scala +++ b/webapi/src/test/scala/org/knora/webapi/slice/admin/domain/service/DspIngestClientLiveSpec.scala @@ -189,17 +189,12 @@ object HttpMockServer { val random: ULayer[TestPort] = ZLayer.fromZIO(Random.nextIntBetween(1000, 10_000).map(TestPort.apply)) } - private def acquireWireMockServer: ZIO[TestPort, Throwable, WireMockServer] = - ZIO.serviceWith[TestPort](_.value).flatMap { port => + val layer: ZLayer[Scope & TestPort, Throwable, WireMockServer] = + ZLayer.fromZIO(ZIO.acquireRelease(ZIO.serviceWithZIO[TestPort] { port => ZIO.attempt { - val server = new WireMockServer(options().port(port)); // No-args constructor will start on port 8080, no HTTPS + val server = new WireMockServer(options().port(port.value)) server.start() server } - } - - private def releaseWireMockServer(server: WireMockServer) = ZIO.attempt(server.stop()).logError.ignore - - val layer: ZLayer[Scope & TestPort, Throwable, WireMockServer] = - ZLayer.fromZIO(ZIO.acquireRelease(acquireWireMockServer)(releaseWireMockServer)) + })(server => ZIO.attempt(server.stop()).logError.orDie)) }