Browse Source

Adapt Kafka SSL smoke test with changes in Testcontainers

See gh-42670
pull/42707/head
Stéphane Nicoll 1 year ago
parent
commit
06127d60b6
  1. 8
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-kafka/src/dockerTest/java/smoketest/kafka/ssl/SampleKafkaSslApplicationTests.java

8
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-kafka/src/dockerTest/java/smoketest/kafka/ssl/SampleKafkaSslApplicationTests.java

@ -22,7 +22,7 @@ import org.awaitility.Awaitility; @@ -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; @@ -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 { @@ -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

Loading…
Cancel
Save