Skip to content

Commit

Permalink
chore: Patch dependency updates (#3261)
Browse files Browse the repository at this point in the history
Co-authored-by: Christian Kleinbölting <[email protected]>
Co-authored-by: Christian Kleinbölting <[email protected]>
  • Loading branch information
3 people authored Jun 3, 2024
1 parent 6c39954 commit d7fe791
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
26 changes: 13 additions & 13 deletions integration/src/test/scala/org/knora/sipi/SipiIT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ object SipiIT extends ZIOSpecDefault {
_ <- MockDspApiServer.resetAndAllowWithPermissionCode(prefix, imageTestfile, 2)
jwt <- createJwt(AuthScope.admin)
response <- requestGet(
Root / prefix / imageTestfile / "file",
Path.root / prefix / imageTestfile / "file",
Header.Cookie(
NonEmptyChunk(
Cookie.Request(
Expand All @@ -98,7 +98,7 @@ object SipiIT extends ZIOSpecDefault {
_ <- MockDspApiServer.resetAndAllowWithPermissionCode(prefix, imageTestfile, 2)
jwt <- createJwt(AuthScope.admin)
response <- requestGet(
Root / prefix / imageTestfile / "file",
Path.root / prefix / imageTestfile / "file",
Header.Cookie(NonEmptyChunk(Cookie.Request("KnoraAuthenticationGAXDALRQFYYDUMZTGMZQ9999", jwt))),
)
requestToDspApiContainsJwt <- MockDspApiServer.verifyAuthBearerTokenReceived(jwt)
Expand All @@ -113,7 +113,7 @@ object SipiIT extends ZIOSpecDefault {
_ <- MockDspApiServer.resetAndAllowWithPermissionCode(prefix, imageTestfile, 2)
jwt <- createJwt(AuthScope.write(Shortcode.unsafeFrom(prefix)))
response <- requestGet(
Root / prefix / imageTestfile / "full" / "max" / "0" / "default.jpg",
Path.root / prefix / imageTestfile / "full" / "max" / "0" / "default.jpg",
Header.Cookie(NonEmptyChunk(Cookie.Request("KnoraAuthenticationGAXDALRQFYYDUMZTGMZQ9999", jwt))),
)
noInteraction <- MockDspApiServer.verifyNoInteraction
Expand Down Expand Up @@ -144,7 +144,7 @@ object SipiIT extends ZIOSpecDefault {
|}""".stripMargin.fromJson[Json]
for {
_ <- MockDspApiServer.resetAndAllowWithPermissionCode(prefix, imageTestfile, permissionCode = 2)
response <- requestGet(Root / prefix / imageTestfile / "knora.json")
response <- requestGet(Path.root / prefix / imageTestfile / "knora.json")
json <- response.body.asString.map(_.fromJson[Json])
expected <- SipiTestContainer.portAndHost.map { case (port, host) => expectedJson(port, host) }
} yield assertTrue(
Expand All @@ -163,7 +163,7 @@ object SipiIT extends ZIOSpecDefault {
test("When getting the file, then Sipi responds with Not Found") {
for {
server <- MockDspApiServer.resetAndGetWireMockServer
response <- requestGet(Root / prefix / "doesnotexist.jp2" / "file")
response <- requestGet(Path.root / prefix / "doesnotexist.jp2" / "file")
} yield assertTrue(response.status == Status.NotFound, verifyNoInteractionWith(server))
},
),
Expand All @@ -178,7 +178,7 @@ object SipiIT extends ZIOSpecDefault {
val dspApiPermissionPath = s"/admin/files/$prefix/$imageTestfile"
for {
server <- MockDspApiServer.resetAndStubGetResponse(dspApiPermissionPath, 200, dspApiResponse)
response <- requestGet(Root / prefix / imageTestfile / "file")
response <- requestGet(Path.root / prefix / imageTestfile / "file")
} yield assertTrue(
response.status == Status.Ok,
verifySingleGetRequest(server, dspApiPermissionPath),
Expand All @@ -194,7 +194,7 @@ object SipiIT extends ZIOSpecDefault {
val dspApiPermissionPath = s"/admin/files/$prefix/$imageTestfile"
for {
server <- MockDspApiServer.resetAndStubGetResponse(dspApiPermissionPath, 200, dspApiResponse)
response <- requestGet(Root / prefix / imageTestfile / "file")
response <- requestGet(Path.root / prefix / imageTestfile / "file")
} yield assertTrue(
response.status == Status.Unauthorized,
verifySingleGetRequest(server, dspApiPermissionPath),
Expand All @@ -208,7 +208,7 @@ object SipiIT extends ZIOSpecDefault {
val dspApiPermissionPath = s"/admin/files/$prefix/$imageTestfile"
for {
server <- MockDspApiServer.resetAndStubGetResponse(dspApiPermissionPath, 404)
response <- requestGet(Root / prefix / imageTestfile / "file")
response <- requestGet(Path.root / prefix / imageTestfile / "file")
} yield assertTrue(
response.status == Status.NotFound,
verifySingleGetRequest(server, dspApiPermissionPath),
Expand All @@ -228,7 +228,7 @@ object SipiIT extends ZIOSpecDefault {
for {
server <- MockDspApiServer.resetAndGetWireMockServer
response <-
requestGet(Root / prefix / "doesnotexist.jp2" / "full" / "max" / "0" / "default.jp2")
requestGet(Path.root / prefix / "doesnotexist.jp2" / "full" / "max" / "0" / "default.jp2")
} yield assertTrue(response.status == Status.NotFound, verifyNoInteractionWith(server))
},
),
Expand All @@ -243,7 +243,7 @@ object SipiIT extends ZIOSpecDefault {
val dspApiPermissionPath = s"/admin/files/$prefix/$imageTestfile"
for {
server <- MockDspApiServer.resetAndStubGetResponse(dspApiPermissionPath, 200, dspApiResponse)
response <- requestGet(Root / prefix / imageTestfile / "full/max/0/default.jp2")
response <- requestGet(Path.root / prefix / imageTestfile / "full/max/0/default.jp2")
} yield assertTrue(
response.status == Status.Ok,
verifySingleGetRequest(server, dspApiPermissionPath),
Expand All @@ -259,7 +259,7 @@ object SipiIT extends ZIOSpecDefault {
val dspApiPermissionPath = s"/admin/files/$prefix/$imageTestfile"
for {
server <- MockDspApiServer.resetAndStubGetResponse(dspApiPermissionPath, 200, dspApiResponse)
response <- requestGet(Root / prefix / imageTestfile / "full/max/0/default.jp2")
response <- requestGet(Path.root / prefix / imageTestfile / "full/max/0/default.jp2")
} yield assertTrue(
response.status == Status.Unauthorized,
verifySingleGetRequest(server, dspApiPermissionPath),
Expand All @@ -273,7 +273,7 @@ object SipiIT extends ZIOSpecDefault {
val dspApiPermissionPath = s"/admin/files/$prefix/$imageTestfile"
for {
server <- MockDspApiServer.resetAndStubGetResponse(dspApiPermissionPath, 404)
response <- requestGet(Root / prefix / imageTestfile / "full/max/0/default.jp2")
response <- requestGet(Path.root / prefix / imageTestfile / "full/max/0/default.jp2")
} yield assertTrue(
response.status == Status.NotFound,
verifySingleGetRequest(server, dspApiPermissionPath),
Expand All @@ -291,7 +291,7 @@ object SipiIT extends ZIOSpecDefault {
test("health check works") {
for {
server <- MockDspApiServer.resetAndGetWireMockServer
response <- requestGet(Root / "server" / "test.html")
response <- requestGet(Path.root / "server" / "test.html")
} yield assertTrue(response.status.isSuccess, verifyNoInteractionWith(server))
},
)
Expand Down
4 changes: 2 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ object Dependencies {
val zioNio = "dev.zio" %% "zio-nio" % ZioNioVersion
val zioMacros = "dev.zio" %% "zio-macros" % ZioVersion
val zioPrelude = "dev.zio" %% "zio-prelude" % ZioPreludeVersion
val zioSttp = "com.softwaremill.sttp.client3" %% "zio" % "3.9.6"
val zioSttp = "com.softwaremill.sttp.client3" %% "zio" % "3.9.7"

// refined
val refined = Seq(
Expand Down Expand Up @@ -112,7 +112,7 @@ object Dependencies {
// found/added by the plugin but deleted anyway
val commonsLang3 = "org.apache.commons" % "commons-lang3" % "3.14.0"

val tapirVersion = "1.10.7"
val tapirVersion = "1.10.8"

val tapir = Seq(
"com.softwaremill.sttp.tapir" %% "tapir-pekko-http-server" % tapirVersion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ import org.knora.webapi.config.KnoraApi
import org.knora.webapi.core.State
import org.knora.webapi.slice.admin.api.AdminApiEndpoints
import org.knora.webapi.slice.common.api.ApiV2Endpoints
import org.knora.webapi.slice.infrastructure.api.PrometheusApp
import org.knora.webapi.slice.infrastructure.api.PrometheusRoutes

object MetricsServer {

private val metricsServer
: ZIO[AdminApiEndpoints & ApiV2Endpoints & KnoraApi & PrometheusApp & Server, Nothing, Unit] = for {
: ZIO[AdminApiEndpoints & ApiV2Endpoints & KnoraApi & PrometheusRoutes & Server, Nothing, Unit] = for {
docs <- DocsServer.docsEndpoints.map(endpoints => ZioHttpInterpreter().toHttp(endpoints))
prometheus <- ZIO.service[PrometheusApp]
_ <- Server.install(prometheus.route ++ docs)
prometheus <- ZIO.service[PrometheusRoutes]
_ <- Server.install(prometheus.routes ++ docs)
_ <- ZIO.never.as(())
} yield ()

Expand Down Expand Up @@ -58,7 +58,7 @@ object MetricsServer {
Runtime.enableRuntimeMetrics,
Runtime.enableFiberRoots,
DefaultJvmMetrics.live.unit,
PrometheusApp.layer,
PrometheusRoutes.layer,
)
} yield ()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import zio.metrics.connectors.prometheus.PrometheusPublisher
/**
* Provides the '/metrics' endpoint serving the metrics in prometheus format.
*/
final case class PrometheusApp(prometheus: PrometheusPublisher) {
val route: HttpApp[Any] = Routes(Method.GET / "metrics" -> handler(prometheus.get.map(Response.text(_)))).toHttpApp
final case class PrometheusRoutes(prometheus: PrometheusPublisher) {
val routes: Routes[Any, Nothing] = Routes(Method.GET / "metrics" -> handler(prometheus.get.map(Response.text)))
}
object PrometheusApp {
val layer = ZLayer.derive[PrometheusApp]
object PrometheusRoutes {
val layer = ZLayer.derive[PrometheusRoutes]
}

0 comments on commit d7fe791

Please sign in to comment.