-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Disable Global Embedded Kafka Support if JUnit Platform is < 1.8 #2481
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
Comments
The I wonder why JUnit does not document this by itself: https://junit.org/junit5/docs/current/user-guide/#running-tests-build-maven-config-params. This is really has nothing to do with Spring for Apache Kafka - just out of scope. /CC @sbrannen |
I don't think we can require a milestone of Surefire. For this reason, Boot's starter parent uses 2.22.2 by default.
This is probably obvious given that I opened the issue here, but I don't agree with this. Spring Kafka requiring 1.8 of the launcher is fairly aggressive and, as the failure above shows, it doesn't work out of the box using the latest non-milestone release of Maven's testing support. It may also fail in an IDE depending on how up-to-date its JUnit Platform integration is. IMO, it's really up to Spring Kafka to document how users can configure their build and/or IDE to meet its requirements or for those requirement to be lowered so that they're met by default. |
Sure! I can see what we can do to disable this listener if launcher is not version |
The Maven documentation in the JUnit 5 User Guide is outdated and can be improved; however, the linked sample project uses Surefire 3.0 M6. The linked Surefire documentation also uses Surefire 3.0 M7 and explains a bit about mismatched versions. For the GraalVM Native Build Tools, I added a dedicated section explaining this as well. So you might want to include information similar to that in the Spring Kafka documentation. As a side note, the JUnit 5 User Guide does actually provide similar guidance in the IntelliJ section, but it's not apparent that one should do that for Maven Surefire versions older than 3.0 M4. |
I've created junit-team/junit5#3093 to improve the documentation in the JUnit 5 User Guide. |
I think we can just use reflection to detect the presence of that method and just exit |
That sounds good to me. If you go down this route, please also add a reflection hint for it so that it'll work in native tests too. |
I think something like:
is enough for both both Maven Surefire |
That's marked as experimental; I'd rather use something that won't go away. |
OK. So, let's watch for that |
Resolves spring-projects#2481 The Maven Surefire plugin uses an older version of JUnit platform which is incompatible with the Global embedded broker. Check that the platform version is compatible before attempting to determine if a global embedded broker should be created.
Resolves spring-projects#2481 The Maven Surefire plugin uses an older version of JUnit platform which is incompatible with the Global embedded broker. Check that the platform version is compatible before attempting to determine if a global embedded broker should be created. Tested with a Spring Boot application.
Resolves #2481 The Maven Surefire plugin uses an older version of JUnit platform which is incompatible with the Global embedded broker. Check that the platform version is compatible before attempting to determine if a global embedded broker should be created. Tested with a Spring Boot application. * Add doc comment. * Add author.
With thanks to @DennisBecker for reporting this on Gitter,
GlobalEmbeddedKafkaTestExecutionListener
requiresjunit-platform-launcher
1.8 or later. Surefire's default configuration doesn't meet this requirement which results in a failure when running./mvnw test
on an app that depends onspring-kafka-test
:The dump reveals the problem:
Once the prerequisites have been documented, we can figure out if there's anything we could/should do in Spring Boot or on start.spring.io to set things up automatically.
The text was updated successfully, but these errors were encountered: