Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
chore: make it possible to debug integration tests with sbt or IDE (#…
…2327)

Co-authored-by: irinaschubert <irina.schubert@dasch.swiss>
  • Loading branch information
seakayone and irinaschubert committed Dec 9, 2022
1 parent 1e11655 commit 3a222bb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
6 changes: 3 additions & 3 deletions build.sbt
Expand Up @@ -199,9 +199,9 @@ lazy val webapi: Project = Project(id = "webapi", base = file("webapi"))
IntegrationTest / testForkedParallel := false, // not run forked tests in parallel
IntegrationTest / parallelExecution := false, // not run non-forked tests in parallel
// Global / concurrentRestrictions += Tags.limit(Tags.Test, 1), // restrict the number of concurrently executing tests in all projects
IntegrationTest / javaOptions += "-Dconfig.resource=fuseki.conf",
// Test / javaOptions ++= Seq("-Dakka.log-config-on-start=on"), // prints out akka config
// Test / javaOptions ++= Seq("-Dconfig.trace=loads"), // prints out config locations
// IntegrationTest / javaOptions ++= Seq("-Dakka.log-config-on-start=on"), // prints out akka config
// IntegrationTest / javaOptions ++= Seq("-Dconfig.trace=loads"), // prints out config locations
// IntegrationTest / javaOptions += "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005", // starts sbt with debug port
IntegrationTest / testOptions += Tests.Argument("-oDF"), // show full stack traces and test case durations
// add test framework for running zio-tests
IntegrationTest / testFrameworks ++= Seq(new TestFramework("zio.test.sbt.ZTestFramework"))
Expand Down
15 changes: 12 additions & 3 deletions docs/05-internals/development/testing.md
Expand Up @@ -37,7 +37,7 @@ You might need to create an integration test because:
In this case create it in the `src/it` source set of our projects.

.NOTE
_Currently only the `webapi` project supports integration tests_
_Currently only the `webapi` project supports integration tests._

Run all integration tests from the terminal.

Expand All @@ -46,5 +46,14 @@ make integration-test
```

.NOTE
_The integration tests currently depend on a locally published Sipi container. That is why we need to start
the `make` command and not `sbt it`._
_The integration tests currently depend on a locally published Sipi container, the make target helps you with that._

## Debugging

You can debug unit tests directly in your IDE.

For debugging the integration tests locally with `sbt` or your IDE you need to have a fresh SIPI container build:

```shell
make docker-build-sipi-image
```
File renamed without changes.
2 changes: 0 additions & 2 deletions webapi/src/it/resources/test.conf
@@ -1,5 +1,3 @@
include "application"

akka {
log-config-on-start = false
loggers = ["akka.event.slf4j.Slf4jLogger"]
Expand Down
Expand Up @@ -454,7 +454,7 @@ case class TriplestoreServiceHttpConnectorImpl(
// to the parent folder where the files can be found
val inputFile = Paths.get("..", elem.path)
if (!Files.exists(inputFile)) {
throw BadRequestException(s"File ${inputFile} does not exist")
throw BadRequestException(s"File ${inputFile.toAbsolutePath} does not exist")
}
val fileEntity =
new FileEntity(inputFile.toFile, ContentType.create(mimeTypeTextTurtle, "UTF-8"))
Expand Down

0 comments on commit 3a222bb

Please sign in to comment.