-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
KafkaEmbedded without @Rule/after() can cause build failures with System.exit #345
Comments
The The Right, the Your Now quoting the Reference Manual:
So, you may consider do not use |
Ok, I guess I didn't realize this was the purpose '@DirtiesContext' in the example. The '@ClassRule' usage shown later would probably accomplish what I need, but then what is the reason you would use the '@embeddedkafka' annotation instead? |
One more time:
Another sample is: you can use |
Yeah I read that, but I guess it's really not clear how it enables that so I saw some opportunity to help improve the docs/example.
|
If someone stumps into similar problem (not necesarilly with |
Thanks @pwamej - if'd you'd like to issue a pull request, please do. Otherwise, I'll address this tomorrow. |
See spring-projects#194 See spring-projects#345 See gradle/gradle#11195 **cherry-pick to 2.4.x, 2.3.x, 2.2.x, 1.3.x**
See #194 See #345 See gradle/gradle#11195 **cherry-pick to 2.4.x, 2.3.x, 2.2.x, 1.3.x**
See #194 See #345 See gradle/gradle#11195 **cherry-pick to 2.4.x, 2.3.x, 2.2.x, 1.3.x**
See #194 See #345 See gradle/gradle#11195 **cherry-pick to 2.4.x, 2.3.x, 2.2.x, 1.3.x**
See #194 See #345 See gradle/gradle#11195 **cherry-pick to 2.4.x, 2.3.x, 2.2.x, 1.3.x** # Conflicts: # spring-kafka-test/src/main/java/org/springframework/kafka/test/EmbeddedKafkaBroker.java
See #194 See #345 See gradle/gradle#11195 **cherry-pick to 2.4.x, 2.3.x, 2.2.x, 1.3.x** # Conflicts: # spring-kafka-test/src/main/java/org/springframework/kafka/test/EmbeddedKafkaBroker.java
Following the example of using @embeddedkafka with KafkaEmbedded in the documentation worked fine in many situations, but found that when executing on build servers as part of a gradle build my tests would succeed, but the overall build would fail with "Process 'Gradle Test Executor 1' finished with non-zero exit value 1".
This was due to improper shutdown of Zookeeper or Kafka originating from the embedded Kafka. I wasn't able to trace down exactly where it was happening, but I determined that if properly shutdown KafkaEmbedded.after() this would not occur. And this would would also get called if the JUnit Rule were used, which wasn't mentioned in the example from the docs and should look like this.
@Autowired @Rule public KafkaEmbedded kafkaEmbedded;
I don't know if anything more should be done about it, but I would propose to update the example in the documentation, it was rather difficult to isolate the cause.
The text was updated successfully, but these errors were encountered: