I have some spring boot tests that are using Kafka internally. For Kafka functionality, I am using @EmbeddedKafka
annotation on each of the test classes that are using Kafka (with same server on each test, localhost:9092).
@SpringBootTest
@DirtiesContext
@EmbeddedKafka(partitions = 1, brokerProperties = { "listeners=PLAINTEXT://localhost:9092", "port=9092" })
class SampleIntegrationTest extends Base integration test {
// code
}
The tests are passing when I run individually or sequentially in test suite but failing when I run the test suite parallelly. In junit-platform.properties
setting:
junit.jupiter.execution.parallel.enabled = true
junit.jupiter.execution.parallel.mode.default = same_thread
junit.jupiter.execution.parallel.mode.classes.default = concurrent
Getting resource access exception on some of the tests. Is there someway these tests can be run parallelly with @EmbeddedKafka
?
Also just to mention, some of these Kafka related integration tests internally sends data on same topics.
Thanks.