-
Notifications
You must be signed in to change notification settings - Fork 38.1k
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
Introduce @DisabledInAotMode
in the TestContext framework
#30834
Comments
At one point I proposed introducing a Spring-specific If we were to introduce such a p.s. |
|
Glad to hear it.
Sorry for being vague. I meant that
Does that make sense now? If so, I think we should go with that. |
Naming is hard. Perhaps Maybe The long-winded alternative is Thoughts? |
@DisabledInAotMode
in the TestContext framework
Makes sense (but not sure why you had to ask). I don't like the names much either. It's up to you, but I would go with the shortest one. |
I am confused, I think. Can we take a step back and check why AOT processing for the test is failing in the first place? |
It has a |
In addition to the Any time something simply does not work in AOT processing (for whatever reason), users currently have no way to disable/ignore a test that relies on the unsupported feature. The end goal is of course to support everything in AOT. Similarly, GraalVM has the same goal for native image support. But there are things that currently do not work in a native image. We created |
Not necessarily. A test may disabled in a native image due to compatibility issues specific to GraalVM native image; however, the same test may work fine with Spring AOT on the JVM. For that reason, we cannot infer that As pointed out in this issue's description, if a test is annotated with Similarly, if someone wishes to disable a test in AOT mode (on the JVM or within a native image), that is possible via a custom JUnit Jupiter @Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@DisabledIf(value = "org.springframework.aot.AotDetector#useGeneratedArtifacts",
disabledReason = "Disabled in Spring AOT mode")
public @interface DisabledInAotMode {
} Note, however, that use of an With regard to In light of the above, the team has decided not to introduce |
If you're interested in seeing |
Could we maybe not log the stack trace unless the user asks for it (requests DEBUG logs for example)? |
Yes, I'll address that in #30867. |
I guess technically
@DisabledInNativeImage
doesn't mean "disable AOT processing", but if the annotation is there, it's probably a sign that we don't expect AOT to work? So the stack traces (logged at WARN level) seem harsh, and hard to debug (there's no hint as to why it's there). Arguably it shouldn't even be a warning. To reproduce just add a@MockBean
and@DisabledInNativeImage
to a test and and try to run native tests. The test doesn't run but the exception is logged in the build.Example from PetClinic:
The text was updated successfully, but these errors were encountered: