Adapt Kafka SSL smoke test with changes in Testcontainers

See gh-42670
This commit is contained in:
Stéphane Nicoll
2024-10-15 16:50:57 +02:00
parent 29bd974f14
commit 06127d60b6

View File

@@ -22,7 +22,7 @@ import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.kafka.KafkaContainer;
import org.testcontainers.kafka.ConfluentKafkaContainer;
import org.testcontainers.utility.MountableFile;
import smoketest.kafka.Consumer;
import smoketest.kafka.Producer;
@@ -55,8 +55,8 @@ import static org.hamcrest.Matchers.not;
class SampleKafkaSslApplicationTests {
@Container
public static KafkaContainer kafka = TestImage.container(KafkaContainer.class)
.withEnv("KAFKA_LISTENER_SECURITY_PROTOCOL_MAP", "PLAINTEXT:SSL,BROKER:PLAINTEXT")
public static ConfluentKafkaContainer kafka = TestImage.container(ConfluentKafkaContainer.class)
.withEnv("KAFKA_LISTENER_SECURITY_PROTOCOL_MAP", "PLAINTEXT:SSL,BROKER:PLAINTEXT,CONTROLLER:PLAINTEXT")
.withEnv("KAFKA_AUTO_CREATE_TOPICS_ENABLE", "true")
.withEnv("KAFKA_SSL_CLIENT_AUTH", "required")
.withEnv("KAFKA_SSL_KEYSTORE_LOCATION", "/etc/kafka/secrets/certs/test-server.p12")
@@ -75,7 +75,7 @@ class SampleKafkaSslApplicationTests {
@DynamicPropertySource
static void kafkaProperties(DynamicPropertyRegistry registry) {
registry.add("spring.kafka.bootstrap-servers",
() -> String.format("%s:%s", kafka.getHost(), kafka.getMappedPort(9093)));
() -> String.format("%s:%s", kafka.getHost(), kafka.getMappedPort(9092)));
}
@Autowired