Skip to content

Commit 479d15e

Browse files
committed
Add Kafka Listener environment variable
Add Kafka Listener environment variable. Apparently newer versions of Kafka do not work nicely with Test Containers yet without the KAFKA_LISTENERS environment variable. Uncovered this solution through a GitHub issue with testcontainers -> testcontainers/testcontainers-java#9506 Although the referred-to issue is from November 2024, the issue lies with Kafka, which hasn't solved it yet. #552
1 parent 8883fb9 commit 479d15e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

kafka-spring-boot-3-integrationtests/src/test/java/org/axonframework/extensions/kafka/integration/StreamableKafkaSourceIntegrationTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
class StreamableKafkaSourceIntegrationTest {
4242

4343
@Container
44-
private static final KafkaContainer KAFKA_CONTAINER = new KafkaContainer("apache/kafka");
44+
private static final KafkaContainer KAFKA_CONTAINER = new KafkaContainer("apache/kafka-native")
45+
.withEnv("KAFKA_LISTENERS", "PLAINTEXT://:9092,BROKER://:9093,CONTROLLER://:9094");
4546

4647
private ApplicationContextRunner testApplicationContext;
4748

kafka-spring-boot-3-integrationtests/src/test/java/org/axonframework/extensions/kafka/integration/TokenReplayIntegrationTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
class TokenReplayIntegrationTest {
5757

5858
@Container
59-
private static final KafkaContainer KAFKA_CONTAINER = new KafkaContainer("apache/kafka");
59+
private static final KafkaContainer KAFKA_CONTAINER = new KafkaContainer("apache/kafka-native")
60+
.withEnv("KAFKA_LISTENERS", "PLAINTEXT://:9092,BROKER://:9093,CONTROLLER://:9094");
6061

6162
private ApplicationContextRunner testApplicationContext;
6263

0 commit comments

Comments
 (0)