`confluentinc/cp-kafka:6.2.2` and `7.0.1` don't work with `KafkaContainer`
See original GitHub issueThis issue has been originally reported by @simonbasle in our Testcontianers Slack.
While we initially thought this is related to GitHub Actions, it seems this is a general incompatibility of KafkaContainer
with cp-kafka
images >= 6.2.2
.
During container startup, our InternalCommandPortListeningCheck
will fail with logs along the lines of:
17:57:13.528 WARN org.testcontainers.containers.wait.internal.InternalCommandPortListeningCheck - An exception while executing the internal check: Container.ExecResult(exitCode=137, stdout=, stderr=Ncat: Version 7.70 ( https://nmap.org/ncat )
Ncat: Connection to 127.0.0.1 failed: Connection refused.
Ncat: Trying next address...
Ncat: Cannot assign requested address.
/bin/bash: connect: Cannot assign requested address
/bin/bash: /dev/tcp/localhost/9093: Cannot assign requested address
Subsequently, our exec
is failing:
17:57:13.532 INFO 🐳 [confluentinc/cp-kafka:6.2.2] - Container confluentinc/cp-kafka:6.2.2 started in PT2.1713743S
17:57:13.532 DEBUG org.testcontainers.containers.ExecInContainerPattern - /hungry_newton: Running "exec" command: kafka-configs --alter --bootstrap-server BROKER://994010ec6ac8:9092 --entity-type brokers --entity-name 1 --add-config advertised.listeners=[PLAINTEXT://127.0.0.1:62036,BROKER://994010ec6ac8:9092]
17:57:13.669 ERROR 🐳 [confluentinc/cp-kafka:6.2.2] - Could not start container
com.github.dockerjava.api.exception.ConflictException: Status 409: {"message":"Container 994010ec6ac8c3cb2ff554a849fdba13b8e38ec6798585d648a766b601fbfd6c is not running"}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Kafka Containers - Testcontainers for Java
Create a KafkaContainer to use it in your tests: ... The correspondence between Confluent Platform versions and Kafka versions can be seen in...
Read more >Advanced Testing Techniques for Spring for Apache Kafka
The @Testcontainers annotation manages the lifecycle of the KafkaContainer . You can create a test topic utilizing Spring for Kafka's Admin API ...
Read more >kafka after reconnect with docker: Connection to node could ...
The reconnect problem happen sometimes (is not regular) and the kafka container remain up but disconnected from the net. This is my docker- ......
Read more >Testing Kafka containers with Testcontainers: There and back ...
I Don't Always Test My Streams, But When I Do, I Do it in Production (Viktor ... confluent. 1k views. •. 62 slides....
Read more >How to Set Up Kafka Integration Test - Grape Up
TestContainers is an open-source Java library specialized in providing all needed solutions ... implementation( "io.confluent:kafka-avro-serializer:6.1.0" ).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi
Confirmed that TestContainers 16.3 fails to start even GenericContainer for cp-kafka:7.1.1:
Log output:
Thanks for your help in debugging this @kiview !
On a side note, about the
Ncat
log, there is still some such logs visible if you enable trace logging, even with6.2.1
… That’s because of some polling aspect, I’m assuming.So right after these logs, we get a success with 6.2.1:
But with 6.2.2 we get an error: