-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add a test case for retrying code gen after first attempt failed
due to Docker being unavailable
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...s/src/test/kotlin/dev/monosoul/jooq/artifact/WorksAfterFailingToFindDockerArtifactTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package dev.monosoul.jooq.artifact | ||
|
||
import org.junit.jupiter.api.Test | ||
import org.testcontainers.utility.MountableFile.forClasspathResource | ||
import strikt.api.expect | ||
import strikt.assertions.contains | ||
import strikt.assertions.isSuccess | ||
|
||
class WorksAfterFailingToFindDockerArtifactTest { | ||
|
||
@Test | ||
fun `should be possible to generate jooq classes even after it failed on first attempt`() { | ||
// given | ||
val gradleContainer = GradleContainer(dockerSocketPath = "/var/run/docker-alt.sock").apply { | ||
withEnv("TESTCONTAINERS_RYUK_DISABLED", "true") | ||
withCopyToContainer(forClasspathResource("/testproject"), projectPath) | ||
withCopyToContainer(forClasspathResource("/gradle_run.sh"), "/gradle_run.sh") | ||
withCommand("/gradle_run.sh") | ||
} | ||
|
||
// when & then | ||
expect { | ||
catching { | ||
gradleContainer.start() | ||
gradleContainer.stop() | ||
}.isSuccess() | ||
|
||
that(gradleContainer.output).contains("BUILD SUCCESSFUL in ") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
gradle classes --info --stacktrace | ||
|
||
export DOCKER_HOST=unix:///var/run/docker-alt.sock | ||
export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker-alt.sock | ||
|
||
gradle classes --info --stacktrace |