It's quite possible there's gaps on OkHttp when executed on GraalVM.
We should do the Gradle work to run our test suite on it. It appears possible, though awkward.
https://github.com/spring-projects-experimental/spring-graalvm-native/issues/22
Spring uses JUnit 5 in the above example. If doing our tests on GraalVM requires upgrading to JUnit 5, we should probably do that too.
Check if that's interesting to use GraalVM capability to create shared libraries
Interesting...
Wow
Test run finished after 966 ms
[ 101 containers found ]
[ 2 containers skipped ]
[ 99 containers started ]
[ 1 containers aborted ]
[ 98 containers successful ]
[ 0 containers failed ]
[ 1096 tests found ]
[ 68 tests skipped ]
[ 1025 tests started ]
[ 0 tests aborted ]
[ 1025 tests successful ]
[ 0 tests failed ]
Do you want any help with any aspect of this? exploring best ways to setup reflection with junit? adding support in PlatformRule to use NativeImageDetector.inNativeImage()? fixing tests?
I'll assume no, but happy to chip in when and if you think I can help.
Yeah I'd love help.
In hacking on this yesterday I learned just how annoying it is to pull one moduleβs tests into another module's dependencies. My conclusion was to make this into a task we can use from any module, and not a separate module. Which led to this PR:
https://github.com/palantir/gradle-graal/pull/393
The next natural step I see while waiting on the above is to temporarily manually move a few tests into native-image-tests/src/main/java to execute 'em in Graal. Presumably there's gonna be challenges there! Getting CallTest passing will be a nice milestone.
@swankjesse +1 - graal itself doesn't add additional modules, just a target for running nativeImage. Is that an option here?
nativeImage -> jar
as
graalTest -> test?
Yep!
POC graal test with okhttp and mockwebserver with only Junit5
https://github.com/yschimke/okhttp/pull/5
$ ./native-image-tests/build/graal/ConsoleLauncher --select-class okhttp3.CallKotlinTest
Thanks for using JUnit! Support its development at https://junit.org/sponsoring
β·
ββ JUnit Jupiter β
ββ CallKotlinTest β
ββ legalToExecuteTwiceCloning() β
ββ testMockWebserverRequest() β
Test run finished after 168 ms
[ 2 containers found ]
[ 0 containers skipped ]
[ 2 containers started ]
[ 0 containers aborted ]
[ 2 containers successful ]
[ 0 containers failed ]
[ 2 tests found ]
[ 0 tests skipped ]
[ 2 tests started ]
[ 0 tests aborted ]
[ 2 tests successful ]
[ 0 tests failed ]
Closing this out, I think remaining work is really a migrate all tests to junit5 task.
Most helpful comment
POC graal test with okhttp and mockwebserver with only Junit5
https://github.com/yschimke/okhttp/pull/5