-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems running embedded kafka with multiple scalatests #28
Comments
I replied to the SO question - you should probably look into |
@IoDmitri There are certain situations when using this library that could cause your tests to fail because of SBT's parallel execution of tests. I've found that disabling parallel execution helps with those situations: |
@IoDmitri any news on this? |
@manub The issue has been resolved by running before and after each, this prevents the shutdown/startup from bleeding into other test suits. |
Brilliant! |
@manub class KafkaEventConsumerSpecs extends FunSuite with BeforeAndAfterEach {
implicit val streamingConfig = EmbeddedKafkaConfig(kafkaPort = 9092, zooKeeperPort = 2181)
override protected def beforeEach(): Unit = {
EmbeddedKafka.start()
}
override protected def afterEach(): Unit = {
EmbeddedKafka.stop()
}
test("consumes 1") {}
test("consumes 2") {}
} sbt
In above example, the topics in first test are visible to second test. |
@prayagupd which version of |
@manub I'm using 0.11.0 (https://github.com/nihil-os/streaming-driver/blob/master/build.sbt#L29). The issue actually is while running multiple tests at the same time. If I run individually works fine. Saw javax.management.InstanceAlreadyExistsException: kafka.consumer:type=app-info,id=testKafkaEventConsumer
at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
at org.apache.kafka.common.utils.AppInfoParser.registerAppInfo(AppInfoParser.java:58)
at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:695)
at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:584)
at org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:566) Seems first test did not clean up the consumer info, as the second test has similar |
It seems to me you're registering twice the same |
Im having issues with embedded kafka when I run it within multiple scalatesst suits. Here is my SO question that displays more of the code and details the issue.
The text was updated successfully, but these errors were encountered: