-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
@EnabledInNativeImage
is not properly supported at the class level
#3745
Comments
@EnabledInNativeImage
is only valid when marked on the function body and has no effect when marked on the class.@EnabledInNativeImage
is only valid when marked on the function body and has no effect when marked on the class
The plugin works in two stages. First it generates a 'native-tests' image. During this stage it launches all tests in a non-native image and uses the The output explains as much:
Looking at the contents of
And that is entirely expected. The |
On second consideration, the On third thought, to rerun a test plan, it would make more sense to collect all the test plan leave nodes in |
|
Yeah it is definitively a bug. The @sbrannen I think the @Override
public void testPlanExecutionFinished(TestPlan testPlan) {
if (!this.enabled) {
return;
}
List<String> uniqueIds = testPlan.getRoots().stream()
.map(testPlan::getDescendants)
.flatMap(Collection::stream)
.filter(testIdentifier -> testPlan.getChildren(testIdentifier).isEmpty())
.map(TestIdentifier::getUniqueId)
.collect(Collectors.toList());
... write the unique ids to file
} |
@linghengqian What is your concrete use case for using this annotation? Typically, tests are written in a way so they work when run in a regular JVM but potentially not when running in the native image. Thus, |
|
@EnabledInNativeImage
is only valid when marked on the function body and has no effect when marked on the class@EnabledInNativeImage
is not properly supported at the class level
@linghengqian and @mpkorstanje, thanks for the feedback and brainstorming! 👍 We'll look into a fix. |
Output with the changes from #3785:
|
* Update to latest version of native build tools * Track descendants of skipped containers * Disable integration test if GRAALVM_HOME env var is not set Fixes #3745.
|
As discussed in #3040, the corresponding JUnit artifact could embed a native-image.properties file to avoid this issue. |
@linghengqian |
|
Steps to reproduce
@EnabledInNativeImage
is only valid when marked on the function body and has no effect when marked on the class. This means that the following snippet has no problem.@EnabledInNativeImage
is invalid.com.lingh.ClassLevelTest.testOnClass()
is not executed in nativeTest.@EnabledInNativeImage
failure in some unit tests apache/shardingsphere#30031 and Improve GraalVM Reachability Metadata and corresponding nativeTest related unit tests apache/shardingsphere#29052 .Context
Jupiter
Maven Wrapper 3.9.5
/IntelliJ IDEA 2023.3.6 (Ultimate Edition)
Deliverables
The text was updated successfully, but these errors were encountered: