Skip to content

Commit cda5609

Browse files
authored
Fix zookeeper initialization (#8433)
1 parent e2b2d85 commit cda5609

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

modules/kafka/src/main/java/org/testcontainers/containers/KafkaContainer.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,14 @@ protected void containerIsStarting(InspectContainerResponse containerInfo) {
182182
// exporting KAFKA_ADVERTISED_LISTENERS with the container hostname
183183
command += String.format("export KAFKA_ADVERTISED_LISTENERS=%s\n", kafkaAdvertisedListeners);
184184

185-
if (this.kraftEnabled && isLessThanCP740()) {
185+
if (!this.kraftEnabled || isLessThanCP740()) {
186186
// Optimization: skip the checks
187187
command += "echo '' > /etc/confluent/docker/ensure \n";
188-
command += commandKraft();
189188
}
190189

191-
if (!this.kraftEnabled) {
192-
// Optimization: skip the checks
193-
command += "echo '' > /etc/confluent/docker/ensure \n";
190+
if (this.kraftEnabled) {
191+
command += commandKraft();
192+
} else if (this.externalZookeeperConnect == null) {
194193
command += commandZookeeper();
195194
}
196195

0 commit comments

Comments
 (0)