-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Kafka container should not be required in some tests #31863
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
base: main
Are you sure you want to change the base?
Conversation
mshima
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://github.com/jhipster/generator-jhipster/actions/runs/20666629893/job/59344143827?pr=31863.
Backend test is taking 10 minutes. It's probably probing Kafka server.
00577ff to
602cabc
Compare
generators/spring-boot/templates/src/test/resources/config/application.yml.ejs
Outdated
Show resolved
Hide resolved
...es/src/test/java/_package_/config/KafkaTestContainersSpringContextCustomizerFactory.java.ejs
Outdated
Show resolved
Hide resolved
4186c1d to
f3abf03
Compare
|
@mshima WDYT? |
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses issue #31133 by making Kafka test containers optional rather than required for all tests. The changes enable tests to use Spring Cloud Stream's in-memory TestChannelBinder by default, only requiring Kafka-specific configuration when explicitly opted in via the @EmbeddedKafka annotation.
Changes:
- Removed automatic
@EmbeddedKafkaannotation from all integration tests - Modified test configuration to disable Kafka by default and use test binder
- Created separate
application-kafka.ymlprofile for Kafka-enabled tests - Updated context customizer to load Kafka config only when
@EmbeddedKafkais present
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| KafkaTestContainersSpringContextCustomizerFactory.java.ejs | Changed from starting Kafka containers to loading application-kafka.yml when @embeddedkafka is detected |
| generator.ts | Removed automatic @embeddedkafka annotation addition to integration tests |
| generator.spec.ts.snap | Updated snapshot to reflect removal of automatic @embeddedkafka annotation |
| application.yml.ejs | Disabled Kafka by default: excluded KafkaAutoConfiguration, disabled function scanning, set test binder as default |
| application-kafka.yml.ejs | New file containing Kafka-specific configuration (function definitions and bindings) loaded when @embeddedkafka is used |
| files.ts | Added conditional generation of application-kafka.yml for Kafka-enabled projects |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| } catch (Exception e) { | ||
| log.error("Failed to load application-kafka.yml", e); | ||
| throw new RuntimeException(e); |
Copilot
AI
Jan 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrapping the IOException in a RuntimeException loses the specific exception type. Consider using a more specific exception or providing more context in the RuntimeException message to aid debugging. For example, you could use: throw new RuntimeException("Failed to load application-kafka.yml configuration file", e)
| throw new RuntimeException(e); | |
| throw new RuntimeException("Failed to load application-kafka.yml configuration file", e); |
|
Kafka testcontainer doesn't seem to be started at all. |
|
Superseded by #32079 |
|
Still relevant. |


Fix #31133