From 5d4ca74d914f232317679a740f19dac2b8756adf Mon Sep 17 00:00:00 2001 From: James Ward Date: Tue, 27 Feb 2024 21:32:02 -0700 Subject: [PATCH] logging from container and retries --- build.gradle.kts | 2 +- integration_testing/build.gradle.kts | 5 ++--- .../src/test/kotlin/io/grpc/kotlin/ExamplesTest.kt | 7 +++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index fe7b751c..07656a08 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -86,7 +86,7 @@ subprojects { } retry { - maxRetries.set(10) + maxRetries = 10 } afterSuite( diff --git a/integration_testing/build.gradle.kts b/integration_testing/build.gradle.kts index 5d5640ab..05ff7084 100644 --- a/integration_testing/build.gradle.kts +++ b/integration_testing/build.gradle.kts @@ -15,8 +15,8 @@ dependencies { testImplementation(libs.gradle.tooling.api) testImplementation(libs.commons.io) testImplementation(libs.junit.jupiter) + testImplementation(libs.slf4j.simple) testRuntimeOnly(libs.junit.platform.launcher) - testRuntimeOnly(libs.slf4j.simple) } tasks.named("test") { @@ -34,8 +34,7 @@ tasks.named("test") { } retry { - maxRetries = 1 - maxFailures = 1 + maxRetries = 3 } systemProperties["grpc-kotlin-version"] = project.version diff --git a/integration_testing/src/test/kotlin/io/grpc/kotlin/ExamplesTest.kt b/integration_testing/src/test/kotlin/io/grpc/kotlin/ExamplesTest.kt index 68b7c700..ab578e18 100644 --- a/integration_testing/src/test/kotlin/io/grpc/kotlin/ExamplesTest.kt +++ b/integration_testing/src/test/kotlin/io/grpc/kotlin/ExamplesTest.kt @@ -5,7 +5,9 @@ import org.gradle.testkit.runner.GradleRunner import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.io.TempDir +import org.slf4j.LoggerFactory import org.testcontainers.containers.GenericContainer +import org.testcontainers.containers.output.Slf4jLogConsumer import org.testcontainers.containers.wait.strategy.Wait import java.io.File import java.net.URI @@ -17,6 +19,8 @@ import kotlin.io.path.inputStream class ExamplesTest { + private val logger = LoggerFactory.getLogger(ExamplesTest::class.java) + // todo: add test to verify jdk8 usage @Test fun server_client(@TempDir tempDir: Path) { @@ -73,11 +77,14 @@ class ExamplesTest { .withGradleDistribution(distributionUrl) .build() + val logConsumer = Slf4jLogConsumer(logger) + val container = GenericContainer("grpc-kotlin-examples-server") .withExposedPorts(50051) .waitingFor(Wait.forListeningPort()) container.start() + container.followOutput(logConsumer) val clientResult = GradleRunner.create() .withProjectDir(tempDir.toFile())