Skip to content

Commit 416f33a

Browse files
committed
test(kafka): ensure ProducerSystemTest can connect to kafka
Without, the test connects to a kafka instance of a previous spring context instance - which is an embeddedkafka and not available
1 parent 95c3a11 commit 416f33a

File tree

1 file changed

+2
-2
lines changed
  • springwolf-examples/springwolf-kafka-example/src/test/java/io/github/stavshamir/springwolf/example/kafka

1 file changed

+2
-2
lines changed

springwolf-examples/springwolf-kafka-example/src/test/java/io/github/stavshamir/springwolf/example/kafka/ProducerSystemTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import org.springframework.boot.ssl.DefaultSslBundleRegistry;
1616
import org.springframework.boot.test.context.SpringBootTest;
1717
import org.springframework.boot.test.mock.mockito.SpyBean;
18-
import org.springframework.test.annotation.DirtiesContext;
18+
import org.springframework.test.context.TestPropertySource;
1919
import org.testcontainers.containers.DockerComposeContainer;
2020
import org.testcontainers.junit.jupiter.Container;
2121
import org.testcontainers.junit.jupiter.Testcontainers;
@@ -39,7 +39,7 @@
3939
classes = {SpringwolfKafkaExampleApplication.class},
4040
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
4141
@Testcontainers
42-
@DirtiesContext
42+
@TestPropertySource(properties = {"spring.kafka.bootstrap-servers=localhost:9092"})
4343
@TestMethodOrder(OrderAnnotation.class)
4444
// @Ignore("Uncomment this line if you have issues running this test on your local machine.")
4545
public class ProducerSystemTest {

0 commit comments

Comments
 (0)