-
Notifications
You must be signed in to change notification settings - Fork 15
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
chore: update maven surefire plugin #580
Conversation
Warning: This pull request is touching the following templated files:
|
pom.xml
Outdated
@@ -828,7 +826,7 @@ | |||
<goals> | |||
<goal>test</goal> | |||
</goals> | |||
<phase>test</phase> |
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.
For the sake of maintaining Kokoro efficiency, would it be possible to keep the test
phase? The advantage that it brings over integration-test
and verify
is that it doesn't require classes to be packaged/deployed so I'm concerned that using integration-test
might increase the duration of the builds.
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.
Do you mean I should create another execution
, so we can have two executions
like
<execution>
<id>test-native</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
<execution>
<id>integration-test-native</id>
<goals>
<goal>test</goal>
</goals>
<phase>integration-test</phase>
</execution>
@@ -804,8 +803,7 @@ | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-surefire-plugin</artifactId> | |||
<!-- Must use older version of surefire plugin for native-image testing. --> | |||
<version>2.22.2</version> |
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.
Thanks for the upgrade @JoeWang1127! Would it be possible to do a quick check with a few handwritten libraries? (pubsub, spanner and bigquery, for example) I remember this causing some issues a while back when I tried it out so. what to double check if this is still a problem. We could create a draft PR in those libs, copy-paste this profile, rename it to something like native-2
and modify the .kokoro/build.sh
to use -Pnative-2
)
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.
Sure, when you think the profile is OK, I'll verify it in handwritten libraries.
.kokoro/build.sh
Outdated
RETURN_CODE=$? | ||
;; | ||
graalvm17) | ||
# Run Unit and Integration Tests with Native Image | ||
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative test | ||
mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative integration-test |
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.
I agree with @mpeddada1 's concerns, but want to also add as a side-note:
mvn integration-test
should rarely be directly invoked. Instead, mvn post-integration-test
or mvn verify
should be preferred depending on the situation. See the Maven lifecycle documentation for additional information.
In this specific case of -Pnative
, the configurations become unique due to the behavior of the native image plugin, and we should be using the mvn test
goal - not verify
or post-integration-test
.
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.
I changed it to integration-test
because it is a limitation in maven, please see the reference
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.
Thanks for link, @JoeWang1127. Correct me if I'm looking at an incorrect section but it looks like the integration-test
phase was only suggested as a workaround for those experiencing the the long classpath issue in Windows. Reference: https://graalvm.github.io/native-build-tools/latest/maven-plugin.html#long_classpath_and_shading_support. Since our test jobs aren't on windows we shouldn't be experiencing the same issue.
That being said, testing on different platforms can be something to consider in the future. cc/ @burkedavison
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.
@mpeddada1 thanks, I think you're right, the integration-test
phase is used in Windows.
I'll change back to test
phase.
It has the follow error if I changed to test
phase.
[ERROR] Test configuration file wasn't found. Make sure that test execution wasn't skipped.
I'm guessing there's an issue with JUnit dependency (this is specified in the reference). I'll keep looking.
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.
I think you're on the right track. According to the reference:
However, if you are using a version of Maven Surefire prior to 3.0 M4 you will need to add an explicit dependency on the junit-platform-launcher artifact to the dependencies section of your native profile configuration as in the following example.
Perhaps we can also try explicitly specifying versions greater than 3.0.0-M5, like 3.0.0-M6
. This looks like a relevant issue:graalvm/native-build-tools#151
Hi @burkedavison and @mpeddada1, I have two questions related to this PR. PTAL.
This is harder than I thought so I created a test project to verify the Do you have any other thoughts about this? PS: I left a comment in graalvm/native-build-tools#378, thanks @mpeddada1 |
We should change it to |
<!-- Must use older version of surefire plugin for native-image testing. --> | ||
<version>2.22.2</version> | ||
<dependencies> | ||
<dependency> |
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.
Move junit-vintage-engine
inside maven-surefire-plugin
, otherwise the plugin would use surefire-junit4
provider instead of the surefire-junit-platform
provider.
<artifactId>junit-platform-native</artifactId> | ||
<version>0.9.20</version> | ||
<scope>test</scope> | ||
<groupId>org.opentest4j</groupId> |
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.
This dependency is needed to resolve class org.opentest4j.TestAbortedException
Error log without this dependency:
Failures (1):
JUnit Jupiter
=> org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to execute tests
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:113)
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
[...]
Caused by: java.lang.NoClassDefFoundError: org.opentest4j.TestAbortedException
org.junit.jupiter.engine.support.OpenTest4JAndJUnit4AwareThrowableCollector.<clinit>(OpenTest4JAndJUnit4AwareThrowableCollector.java:38)
org.junit.jupiter.engine.support.JupiterThrowableCollectorFactory.createThrowableCollector(JupiterThrowableCollectorFactory.java:34)
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:89)
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
[...]
@@ -95,13 +95,6 @@ | |||
</excludes> | |||
<reportNameSuffix>sponge_log</reportNameSuffix> | |||
</configuration> | |||
<dependencies> | |||
<dependency> |
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.
I'm not sure where this dependency is used.
It turns out that this dependency prevents maven-surefire-plugin
using Junit 5 Platform.
Before the change:
[INFO] --- maven-surefire-plugin:3.0.0:test (default-test) @ google-cloud-orgpolicy ---
[INFO] Using configured provider org.apache.maven.surefire.junitcore.JUnitCoreProvider
After the change:
[INFO] --- maven-surefire-plugin:3.0.0:test (default-test) @ google-cloud-orgpolicy ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
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.
It looks like this dependency was added while ago in #37 to fix an issue with mvn verify
in java-speech. To double check, perhaps we can run a test with java-speech to make sure that's still not the case?
Hi @burkedavison and @mpeddada1, I had to remove a dependency in Since I modified the shared config, I built a SNAPSHOT version and test it against |
LGTM, but would like this approved by @mpeddada1 |
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.
Excellent investigation @JoeWang1127! Added a few comments.
<artifactId>junit-platform-native</artifactId> | ||
<version>0.9.20</version> | ||
<scope>test</scope> | ||
<groupId>org.opentest4j</groupId> |
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.
Could we add a source comment for this dependency addition?
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.
done.
@@ -95,13 +95,6 @@ | |||
</excludes> | |||
<reportNameSuffix>sponge_log</reportNameSuffix> | |||
</configuration> | |||
<dependencies> | |||
<dependency> |
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.
It looks like this dependency was added while ago in #37 to fix an issue with mvn verify
in java-speech. To double check, perhaps we can run a test with java-speech to make sure that's still not the case?
I tested Steps to reproduce the test result:
I also re-test |
Fixes #577 ☕️