Skip to content

Commit

Permalink
logging from container and retries
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesward committed Feb 28, 2024
1 parent 69bcfe9 commit 5d4ca74
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ subprojects {
}

retry {
maxRetries.set(10)
maxRetries = 10
}

afterSuite(
Expand Down
5 changes: 2 additions & 3 deletions integration_testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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>("test") {
Expand All @@ -34,8 +34,7 @@ tasks.named<Test>("test") {
}

retry {
maxRetries = 1
maxFailures = 1
maxRetries = 3
}

systemProperties["grpc-kotlin-version"] = project.version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 5d4ca74

Please sign in to comment.