1- import com.github.dockerjava.api.command.InspectContainerResponse
2- import io.github.nomisRev.kafka.Admin
3- import io.github.nomisRev.kafka.AdminSettings
4- import io.github.nomisRev.kafka.await
5- import kotlinx.coroutines.runBlocking
61import org.testcontainers.containers.KafkaContainer
72import org.testcontainers.utility.DockerImageName
3+ import java.lang.System.getProperty
84
95/* *
106 * A singleton `Kafka` Test Container.
@@ -30,17 +26,18 @@ import org.testcontainers.utility.DockerImageName
3026 * @see https://pawelpluta.com/optimise-testcontainers-for-better-tests-performance/
3127 */
3228class Kafka private constructor(imageName : DockerImageName ) : KafkaContainer(imageName) {
33-
29+
3430 companion object {
31+ private val image: DockerImageName =
32+ if (getProperty(" os.arch" ) == " aarch64" ) DockerImageName .parse(" niciqy/cp-kafka-arm64:7.0.1" )
33+ .asCompatibleSubstituteFor(" confluentinc/cp-kafka" )
34+ else DockerImageName .parse(" confluentinc/cp-kafka:6.2.1" )
35+
3536 val container: KafkaContainer by lazy {
36- Kafka (DockerImageName .parse(" niciqy/cp-kafka-arm64:7.0.1" ).asCompatibleSubstituteFor(" confluentinc/cp-kafka" ))
37- .withReuse(true )
38- .withNetwork(null )
39- .withLabel(" io.github.nomisrev.kafka" , " fqn-testcontainers-reuse" )
40- .also { it.start() }
37+ Kafka (image).also { it.start() }
4138 }
4239 }
43-
40+
4441 // override fun containerIsStarted(containerInfo: InspectContainerResponse?, reused: Boolean) {
4542 // super.containerIsStarted(containerInfo, reused)
4643 // // If we're reusing the container, we want to reset the state of the container. We do this by
0 commit comments