You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "f2par0 (via GitHub)" <gi...@apache.org> on 2024/06/13 12:34:27 UTC
[PR] Add kafka integration tests [camel-karaf]
f2par0 opened a new pull request, #348:
URL: https://github.com/apache/camel-karaf/pull/348
Fixes #347
Creates a producer / consumer integration test for kafka
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add camel-kafka integration tests [camel-karaf]
Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo merged PR #348:
URL: https://github.com/apache/camel-karaf/pull/348
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add camel-kafka integration tests [camel-karaf]
Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #348:
URL: https://github.com/apache/camel-karaf/pull/348#discussion_r1639424918
##########
tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaITest.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.camel.itest;
+
+import java.util.function.Consumer;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteITest;
+import org.apache.karaf.camel.itests.CamelKarafTestHint;
+import org.apache.karaf.camel.itests.GenericContainerResource;
+import org.apache.karaf.camel.itests.PaxExamWithExternalResource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.KafkaContainer;
+import org.testcontainers.utility.DockerImageName;
+
+@CamelKarafTestHint(externalResourceProvider = CamelKafkaITest.ExternalResourceProviders.class)
+@RunWith(PaxExamWithExternalResource.class)
+@ExamReactorStrategy(PerClass.class)
+public class CamelKafkaITest extends AbstractCamelSingleFeatureResultMockBasedRouteITest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(CamelKafkaITest.class);
+
+ private static final int KAFKA_PORT = 9092;
Review Comment:
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add camel-kafka integration tests [camel-karaf]
Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #348:
URL: https://github.com/apache/camel-karaf/pull/348#discussion_r1638396153
##########
tests/features/camel-kafka/src/main/java/org/apache/karaf/camel/test/CamelKafkaRouteSupplier.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.camel.test;
+
+import java.util.function.Function;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.kafka.KafkaComponent;
+import org.apache.camel.component.kafka.KafkaConfiguration;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteSupplier;
+import org.apache.karaf.camel.itests.CamelRouteSupplier;
+import org.osgi.service.component.annotations.Component;
+
+
+@Component(
+ name = "karaf-camel-kafka-test",
+ immediate = true,
+ service = CamelRouteSupplier.class
+)
+public class CamelKafkaRouteSupplier extends AbstractCamelSingleFeatureResultMockBasedRouteSupplier {
+
+ @Override
+ public void configure(CamelContext camelContext) {
+ KafkaComponent kafka = new KafkaComponent();
+ KafkaConfiguration config = new KafkaConfiguration();
+ config.setBreakOnFirstError(true);
+ config.setBrokers("localhost:%s".formatted(System.getProperty("kafka.port")));
+ kafka.setConfiguration(config);
+ camelContext.addComponent("kafka", kafka);
+ }
+
+ private static final String KAFKA_TOPIC = "testTopic";
+
+ @Override
+ protected Function<RouteBuilder, RouteDefinition> consumerRoute() {
+ return builder ->
+ builder.fromF("kafka://%s?autoOffsetReset=earliest", KAFKA_TOPIC)
+ .log("received kafka message ${body}");
+ }
+
+ @Override
+ protected void configureProducer(RouteBuilder builder, RouteDefinition producerRoute) {
+ producerRoute.log("calling kafka topic")
+ .setBody(builder.constant("OK"))
+ .toF("kafka://%s?", KAFKA_TOPIC)
Review Comment:
Do we need the trailing question mark?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add camel-kafka integration tests [camel-karaf]
Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #348:
URL: https://github.com/apache/camel-karaf/pull/348#discussion_r1639423764
##########
tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaITest.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.camel.itest;
+
+import java.util.function.Consumer;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteITest;
+import org.apache.karaf.camel.itests.CamelKarafTestHint;
+import org.apache.karaf.camel.itests.GenericContainerResource;
+import org.apache.karaf.camel.itests.PaxExamWithExternalResource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.KafkaContainer;
+import org.testcontainers.utility.DockerImageName;
+
+@CamelKarafTestHint(externalResourceProvider = CamelKafkaITest.ExternalResourceProviders.class)
+@RunWith(PaxExamWithExternalResource.class)
+@ExamReactorStrategy(PerClass.class)
+public class CamelKafkaITest extends AbstractCamelSingleFeatureResultMockBasedRouteITest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(CamelKafkaITest.class);
+
+ private static final int KAFKA_PORT = 9092;
Review Comment:
Doesn't seem to be used so it can removed I guess?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add camel-kafka integration tests [camel-karaf]
Posted by "f2par0 (via GitHub)" <gi...@apache.org>.
f2par0 commented on code in PR #348:
URL: https://github.com/apache/camel-karaf/pull/348#discussion_r1638504850
##########
tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaITest.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.camel.itest;
+
+import java.io.IOException;
+import java.time.Duration;
+import java.util.function.Consumer;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteITest;
+import org.apache.karaf.camel.itests.CamelKarafTestHint;
+import org.apache.karaf.camel.itests.GenericContainerResource;
+import org.apache.karaf.camel.itests.PaxExamWithExternalResource;
+import org.apache.karaf.camel.itests.Utils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.Container;
+import org.testcontainers.containers.FixedHostPortGenericContainer;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
+
+@CamelKarafTestHint(externalResourceProvider = CamelKafkaITest.ExternalResourceProviders.class)
+@RunWith(PaxExamWithExternalResource.class)
+@ExamReactorStrategy(PerClass.class)
+public class CamelKafkaITest extends AbstractCamelSingleFeatureResultMockBasedRouteITest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(CamelKafkaITest.class);
+
+ private static final int KAFKA_PORT = 9092;
+
+ @Override
+ public void configureMock(MockEndpoint mock) {
+ mock.expectedBodiesReceived("OK");
+ }
+
+ @Test
+ public void testResultMock() throws Exception {
+ assertMockEndpointsSatisfied();
+ }
+
+ public static final class ExternalResourceProviders {
+
+ public static GenericContainerResource createKafkaContainer() {
+ int exposedPort = Utils.getNextAvailablePort();
+ final GenericContainer<?> kafkaContainer =
+ new FixedHostPortGenericContainer<>("apache/kafka:3.7.0")
+ .withFixedExposedPort(exposedPort,exposedPort)
+ .withEnv("KAFKA_PROCESS_ROLES", "broker,controller")
+ .withEnv("KAFKA_NODE_ID", "1")
+ .withEnv("KAFKA_CONTROLLER_QUORUM_VOTERS", "1@localhost:9093")
+ .withEnv("KAFKA_CONTROLLER_LISTENER_NAMES", "CONTROLLER")
+ .withEnv("ALLOW_PLAINTEXT_LISTENER", "yes")
+ .withEnv("KAFKA_ADVERTISED_LISTENERS", "EXTERNAL_SAME_HOST://localhost:%s,INTERNAL://localhost:%s".formatted(exposedPort,KAFKA_PORT))
+ .withEnv("KAFKA_LISTENERS", "EXTERNAL_SAME_HOST://0.0.0.0:%s,INTERNAL://localhost:%s,CONTROLLER://:9093".formatted(exposedPort,KAFKA_PORT))
+ .withEnv("KAFKA_LISTENER_SECURITY_PROTOCOL_MAP", "CONTROLLER:PLAINTEXT,INTERNAL:PLAINTEXT,EXTERNAL_SAME_HOST:PLAINTEXT")
+ .withEnv("KAFKA_INTER_BROKER_LISTENER_NAME", "INTERNAL")
+ .withEnv("KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR", "1")
+ // in case more logs needed
+ //.withEnv("KAFKA_LOG4J_LOGGERS","org.apache.kafka=DEBUG,kafka.request.logger=DEBUG,kafka.controller=DEBUG, kafka.coordinator=DEBUG,kafka.log=DEBUG,kafka.server=DEBUG, state.change.logger=DEBUG")
+ ;
+ kafkaContainer.setWaitStrategy(
+ new LogMessageWaitStrategy()
+ .withRegEx(".*Kafka Server started.*")
+ .withStartupTimeout(Duration.ofSeconds(10)));
Review Comment:
yes, it's much easier, I used the official image instead
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add camel-kafka integration tests [camel-karaf]
Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #348:
URL: https://github.com/apache/camel-karaf/pull/348#discussion_r1639427073
##########
tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaITest.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.camel.itest;
+
+import java.util.function.Consumer;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteITest;
+import org.apache.karaf.camel.itests.CamelKarafTestHint;
+import org.apache.karaf.camel.itests.GenericContainerResource;
+import org.apache.karaf.camel.itests.PaxExamWithExternalResource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.KafkaContainer;
+import org.testcontainers.utility.DockerImageName;
+
+@CamelKarafTestHint(externalResourceProvider = CamelKafkaITest.ExternalResourceProviders.class)
+@RunWith(PaxExamWithExternalResource.class)
+@ExamReactorStrategy(PerClass.class)
+public class CamelKafkaITest extends AbstractCamelSingleFeatureResultMockBasedRouteITest {
+
+
Review Comment:
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add camel-kafka integration tests [camel-karaf]
Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #348:
URL: https://github.com/apache/camel-karaf/pull/348#discussion_r1639424146
##########
tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaITest.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.camel.itest;
+
+import java.util.function.Consumer;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteITest;
+import org.apache.karaf.camel.itests.CamelKarafTestHint;
+import org.apache.karaf.camel.itests.GenericContainerResource;
+import org.apache.karaf.camel.itests.PaxExamWithExternalResource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.KafkaContainer;
+import org.testcontainers.utility.DockerImageName;
+
+@CamelKarafTestHint(externalResourceProvider = CamelKafkaITest.ExternalResourceProviders.class)
+@RunWith(PaxExamWithExternalResource.class)
+@ExamReactorStrategy(PerClass.class)
+public class CamelKafkaITest extends AbstractCamelSingleFeatureResultMockBasedRouteITest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(CamelKafkaITest.class);
+
+ private static final int KAFKA_PORT = 9092;
+
+ @Override
+ public void configureMock(MockEndpoint mock) {
+ mock.expectedBodiesReceived("OK");
+ }
+
+ @Test
+ public void testResultMock() throws Exception {
+ assertMockEndpointsSatisfied();
+ }
+
+ public static final class ExternalResourceProviders {
+
+ public static GenericContainerResource createKafkaContainer() {
+ final KafkaContainer kafkaContainer =
+ new KafkaContainer( DockerImageName.parse("confluentinc/cp-kafka:7.6.1"));
Review Comment:
```suggestion
new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:7.6.1"));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add camel-kafka integration tests [camel-karaf]
Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #348:
URL: https://github.com/apache/camel-karaf/pull/348#discussion_r1638394556
##########
tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaITest.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.camel.itest;
+
+import java.io.IOException;
+import java.time.Duration;
+import java.util.function.Consumer;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteITest;
+import org.apache.karaf.camel.itests.CamelKarafTestHint;
+import org.apache.karaf.camel.itests.GenericContainerResource;
+import org.apache.karaf.camel.itests.PaxExamWithExternalResource;
+import org.apache.karaf.camel.itests.Utils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.Container;
+import org.testcontainers.containers.FixedHostPortGenericContainer;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
+
+@CamelKarafTestHint(externalResourceProvider = CamelKafkaITest.ExternalResourceProviders.class)
+@RunWith(PaxExamWithExternalResource.class)
+@ExamReactorStrategy(PerClass.class)
+public class CamelKafkaITest extends AbstractCamelSingleFeatureResultMockBasedRouteITest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(CamelKafkaITest.class);
+
+ private static final int KAFKA_PORT = 9092;
+
+ @Override
+ public void configureMock(MockEndpoint mock) {
+ mock.expectedBodiesReceived("OK");
+ }
+
+ @Test
+ public void testResultMock() throws Exception {
+ assertMockEndpointsSatisfied();
+ }
+
+ public static final class ExternalResourceProviders {
+
+ public static GenericContainerResource createKafkaContainer() {
+ int exposedPort = Utils.getNextAvailablePort();
+ final GenericContainer<?> kafkaContainer =
+ new FixedHostPortGenericContainer<>("apache/kafka:3.7.0")
+ .withFixedExposedPort(exposedPort,exposedPort)
+ .withEnv("KAFKA_PROCESS_ROLES", "broker,controller")
+ .withEnv("KAFKA_NODE_ID", "1")
+ .withEnv("KAFKA_CONTROLLER_QUORUM_VOTERS", "1@localhost:9093")
+ .withEnv("KAFKA_CONTROLLER_LISTENER_NAMES", "CONTROLLER")
+ .withEnv("ALLOW_PLAINTEXT_LISTENER", "yes")
+ .withEnv("KAFKA_ADVERTISED_LISTENERS", "EXTERNAL_SAME_HOST://localhost:%s,INTERNAL://localhost:%s".formatted(exposedPort,KAFKA_PORT))
+ .withEnv("KAFKA_LISTENERS", "EXTERNAL_SAME_HOST://0.0.0.0:%s,INTERNAL://localhost:%s,CONTROLLER://:9093".formatted(exposedPort,KAFKA_PORT))
+ .withEnv("KAFKA_LISTENER_SECURITY_PROTOCOL_MAP", "CONTROLLER:PLAINTEXT,INTERNAL:PLAINTEXT,EXTERNAL_SAME_HOST:PLAINTEXT")
+ .withEnv("KAFKA_INTER_BROKER_LISTENER_NAME", "INTERNAL")
+ .withEnv("KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR", "1")
+ // in case more logs needed
+ //.withEnv("KAFKA_LOG4J_LOGGERS","org.apache.kafka=DEBUG,kafka.request.logger=DEBUG,kafka.controller=DEBUG, kafka.coordinator=DEBUG,kafka.log=DEBUG,kafka.server=DEBUG, state.change.logger=DEBUG")
+ ;
+ kafkaContainer.setWaitStrategy(
+ new LogMessageWaitStrategy()
+ .withRegEx(".*Kafka Server started.*")
+ .withStartupTimeout(Duration.ofSeconds(10)));
Review Comment:
This sounds overcomplicated, why not simply use the dedicated test container for it called `KafkaContainer` with a confluent image like in this blog post https://testcontainers.com/guides/testing-spring-boot-kafka-listener-using-testcontainers/#_write_test_for_kafka_listener
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org