-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: 1.19.0 regression with Kafka #7441
Comments
Hi, can you share how the KafkaContainer is being created, please? |
Hi, we are having the same issue, Kafka container is configured like this: private fun startKafka(): GenericContainer<*> = KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:6.2.1"))
.withExposedPorts(9093)
.withEnv(
mapOf(
"KAFKA_LISTENER_SECURITY_PROTOCOL_MAP" to "BROKER:PLAINTEXT,PLAINTEXT:SASL_PLAINTEXT",
"KAFKA_LISTENER_NAME_PLAINTEXT_SASL_ENABLED_MECHANISMS" to "PLAIN",
"KAFKA_LISTENER_NAME_PLAINTEXT_PLAIN_SASL_JAAS_CONFIG" to
"org.apache.kafka.common.security.plain.PlainLoginModule required " +
"username=\"$kafkaUsername\" " +
"password=\"$kafkaPassword\"" +
"user_admin=\"$kafkaPassword\"; ",
),
)
.withReuse(true)
.apply { start() } |
We faced with the similar issue after upgrading from 1.17.6 to 1.18.3 and 1.19.1. Logs with 1.19.1
Container is trivial import org.springframework.boot.test.util.TestPropertyValues
import org.springframework.context.ApplicationContextInitializer
import org.springframework.context.ConfigurableApplicationContext
import org.testcontainers.containers.KafkaContainer
import org.testcontainers.containers.wait.strategy.Wait
import org.testcontainers.utility.DockerImageName
class KafkaInitializer : ApplicationContextInitializer<ConfigurableApplicationContext> {
override fun initialize(applicationContext: ConfigurableApplicationContext) {
kafka.start()
TestPropertyValues.of(
"spring.kafka.bootstrap-servers=" + kafka.bootstrapServers
).applyTo(applicationContext.environment)
}
companion object {
internal val kafka: KafkaContainer = KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:7.3.3"))
.waitingFor(Wait.forListeningPort())
}
} |
@mfvanek why are you doing it like this?
|
@eddumelendez we use colima for local development on macOS. Sometimes first test in test run may fail without proper waiting strategy. It's especially important for PostgreSQL. For Kafka container it looks like a copy-paste but nevertheless I've tried to remove that line of code and nothing changed :( |
@alex-kuck Although, the issue about not overriding the env vars is happening, I think you are missing some additional configuration, at least for what I read in the official documentation. I am not able to reproduce it. The issue about overriding the env vars should be fixed in the next release due to some internal changes and I would like to add an additional test for jaas but can not reproduce it so far with the information provided. Can you please provide a github repository that works with 1.18.3? |
@eddumelendez Hey, sorry for the late reply 😅 |
Module
Kafka
Testcontainers version
1.19.0
Using the latest Testcontainers version?
Yes
Host OS
Linux, Mac OS
Host Arch
x86, arm, amd64
Docker version
Client: Cloud integration: v1.0.31 Version: 23.0.5 API version: 1.42 Go version: go1.19.8 Git commit: bc4487a Built: Wed Apr 26 16:12:52 2023 OS/Arch: darwin/amd64 Context: default Server: Docker Desktop 4.19.0 (106363) Engine: Version: 23.0.5 API version: 1.42 (minimum version 1.12) Go version: go1.19.8 Git commit: 94d3ad6 Built: Wed Apr 26 16:17:45 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.20 GitCommit: 2806fc1057397dbaeefbea0e4e17bddfbd388f38 runc: Version: 1.1.5 GitCommit: v1.1.5-0-gf19387a docker-init: Version: 0.19.0 GitCommit: de40ad0
What happened?
When upgrading from 1.18.3 to 1.19.0 out tests starting a kafka container are failing to start a container.
Relevant log output
Additional Information
No response
The text was updated successfully, but these errors were encountered: