diff --git a/zoe-cli/Dockerfile b/zoe-cli/Dockerfile index 96b1c79..ff01688 100644 --- a/zoe-cli/Dockerfile +++ b/zoe-cli/Dockerfile @@ -6,7 +6,7 @@ # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -FROM adoptopenjdk:11-jre-openj9 +FROM eclipse-temurin:21-jre-alpine ENV ZOE_INSTALL_DIR=/zoe ENV ZOE_JAR_PATH=${ZOE_INSTALL_DIR}/lib/zoe-cli-final.jar diff --git a/zoe-cli/build.gradle.kts b/zoe-cli/build.gradle.kts index e32740e..1f9c395 100644 --- a/zoe-cli/build.gradle.kts +++ b/zoe-cli/build.gradle.kts @@ -199,10 +199,11 @@ dependencies { implementation("log4j:log4j:1.2.17") testImplementation("org.junit.jupiter:junit-jupiter:5.6.2") - testImplementation("io.kotest:kotest-runner-junit5-jvm:4.2.0") - testImplementation("io.kotest:kotest-assertions-core-jvm:4.2.0") - testImplementation("io.kotest:kotest-property-jvm:4.2.0") + testImplementation("io.kotest:kotest-runner-junit5-jvm:5.9.1") + testImplementation("io.kotest:kotest-assertions-core-jvm:5.9.1") + testImplementation("io.kotest:kotest-property-jvm:5.9.1") testImplementation(platform("org.testcontainers:testcontainers-bom:1.20.3")) //import bom testImplementation("org.testcontainers:testcontainers") + testImplementation("com.google.cloud.tools:jib-core:0.27.3") testImplementation("org.testcontainers:kafka") } diff --git a/zoe-cli/test/com/adevinta/oss/zoe/cli/containerTests.kt b/zoe-cli/test/com/adevinta/oss/zoe/cli/containerTests.kt new file mode 100644 index 0000000..770c617 --- /dev/null +++ b/zoe-cli/test/com/adevinta/oss/zoe/cli/containerTests.kt @@ -0,0 +1,39 @@ +package com.adevinta.oss.zoe.cli + +import io.kotest.core.spec.style.ExpectSpec +import io.kotest.matchers.shouldBe +import org.testcontainers.containers.GenericContainer +import java.nio.file.Paths + +class ContainerTests : ExpectSpec({ + context("Build and test container") { + context("Build container") { + val rootDirectory = Paths.get(System.getProperty("user.dir"), "..").toFile() + + val process = ProcessBuilder("./gradlew", "zoe-cli:jibDockerBuild") + .directory(rootDirectory) + .inheritIO() + .start() + + expect("Build process to finish") { + val exitCode = process.waitFor() + exitCode shouldBe 0 + } + } + + context("Test container config command") { + val container = GenericContainer("adevinta/zoe-cli") + .withCommand("config", "environments", "list") + + expect("Container to start and run") { + container.use { + container.start() + while (container.isRunning) { + Thread.sleep(100) + } + container.logs shouldBe "[]\n" + } + } + } + } +}) \ No newline at end of file diff --git a/zoe-core/build.gradle.kts b/zoe-core/build.gradle.kts index b92b112..d044f4b 100644 --- a/zoe-core/build.gradle.kts +++ b/zoe-core/build.gradle.kts @@ -46,7 +46,7 @@ dependencies { testImplementation(group = "junit", name = "junit", version = "4.12") - testImplementation("org.spekframework.spek2:spek-dsl-jvm:2.0.10") + testImplementation("org.spekframework.spek2:spek-dsl-jvm:2.0.19") testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:2.0.10") // spek requires kotlin-reflect, can be omitted if already in the classpath diff --git a/zoe-service/build.gradle.kts b/zoe-service/build.gradle.kts index bec9797..610e22e 100644 --- a/zoe-service/build.gradle.kts +++ b/zoe-service/build.gradle.kts @@ -26,8 +26,8 @@ dependencies { testImplementation("org.testcontainers:testcontainers:1.20.3") testImplementation("org.testcontainers:kafka:1.20.3") - testImplementation("org.spekframework.spek2:spek-dsl-jvm:2.0.10") - testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:2.0.10") + testImplementation("org.spekframework.spek2:spek-dsl-jvm:2.0.19") + testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:2.0.19") } tasks {