-
Notifications
You must be signed in to change notification settings - Fork 110
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
kafka embedded doesn't start for unit tests #435
Comments
Support for embedding kafka was removed in version 4.0.0 in favour of test containers, the documentation should have been corrected for this though |
Thanks for the quick reply, is it possible to start up the kafka container once for all the tests? Is there some overall test lifecycle listener option? It seems when I include the postgres test container that automatically starts up without any codea and runs for all the tests? - actually that's not right postgres seems to start up for each test class as well. |
A more complete example for JUnit 5 would look something like:
And then test:
|
that's fantastic, thank you. do you want to close this or should we keep this open as a reminder to update the docs? |
leaving it here as a reminder :) |
Expected Behavior
adding the property kafka.embedded.enabled=true should start kafka so unit tests work
Actual Behaviour
unit tests fail trying to connect to kafka
Steps To Reproduce
From the documentation https://micronaut-projects.github.io/micronaut-kafka/latest/guide/#kafkaEmbedded
I believe that kafka.embedded.enabled=true should start kafka embedded for the unit tests
I find the test fail looping trying to connect, however if I add the annoation @requires(property = "foo.bar", value = "stuff") then the tests all pass ( the don't use or need that property )
I added this as part of following the how to add per class lifecyle listeners ( I was going to try and spin up a kafka test container ) I'd much prefer not to spin up a container as it is much quicker using the embedded kafka
I feel this annotation is obviously a side effect and would like to know the correct way to spin up the embeded kafka
I've also tried the annotation from https://blog.wick.technology/micronaut-testing-kafka/ adding @MicronautTest(environments = "kafka") but that makes no difference
Environment Information
ubuntu linux (WSL2) / windows
java 17
Example Application
https://github.com/msillence/micronaut-kafka-unit-test
Version
3.1.3
The text was updated successfully, but these errors were encountered: