Closed antoniomacri closed 3 years ago
Indeed KStreams TopologyTestDriver tests (whitebox testing without creating any Kafka connections) are run via @QuarkusTest
today (ex: TopologyProducerTest ) which starts the application (including TCP connections, thread pools, ...) and rather more suitable for blackbox testing.
I don't know if it would be possible to have a lesser version of @QuarkusTest
that only does the initialization (dependency injection, config injection, ...), but does not start the app (i.e. never calls StartupEvent / @Startup
producers) ?
In my tests I'm actually using beans which @Observes StartupEvent
, so I'd need something different.
This issue is rather outdated. It has been fixed in SmallRye Reactive Messaging.
I think this may have been closed by mistake, as it's quarkus-kstream extension question/issue.
Anyway I've found a solution for this: simply inject a mock of KafkaStreams - a class that extends KafkaStreams and overrides start() to do nothing. The bean being singleton scope, it has to be done via QuarkusTestProfile CDI alternatives.
Actually it would require a change in extension to not initialize a new KafkaStreams if one is provided via test profile.
@cescoffier How has this been fixed? I'm using the latest version of Quarkus with the quarkus-kafka-streams
dependency, and my logs are still full of these warnings when I'm running unit tests with the TopologyTestDriver
. Do I need to configure something to make those go away?
Any progress / further hints on this?
I stil see those logs on Quarkus 3.13.0...
@cescoffier Could it be reopened?
@antoniomacri can you open a new issue with a reproducer?
(BTW, this was fixed for the reactive messaging connector, not kafka streams - not sure you can do anything in kafka streams without modifying kafka streams itself).
Description Test logs are full of warnings like this:
I have tests which only use TopologyTestDriver, so there is no need to instantiate Kafka. Furthermore I cannot "unset" kafka-streams.bootstrap-servers.
Is there any way to get rid of those messages?
I've seen I could use KafkaTestResource, but I think it would be better to have a way to prevent it completely.
Thanks, Antonio