convert undertow groovy test to java#12207
Conversation
|
|
||
| options.setHttpAttributes( | ||
| endpoint -> | ||
| Collections.unmodifiableSet( |
There was a problem hiding this comment.
Suggest to use static import here.
There was a problem hiding this comment.
I found it is better to use
options.setHttpAttributes(endpoint -> ImmutableSet.of(NetworkAttributes.NETWORK_PEER_PORT));
d6dd1df to
04b78e4
Compare
| .addExactPath( | ||
| SUCCESS.rawPath(), | ||
| exchange -> | ||
| exchange.dispatch( | ||
| k -> | ||
| testing.runWithSpan( | ||
| "controller", | ||
| (ThrowingRunnable<Exception>) | ||
| () -> k.getResponseSender().send(SUCCESS.getBody())))) |
There was a problem hiding this comment.
the java AbstractHttpServerTest has a helper method for this, similar to the ones in groovy
I think it would look like:
| .addExactPath( | |
| SUCCESS.rawPath(), | |
| exchange -> | |
| exchange.dispatch( | |
| k -> | |
| testing.runWithSpan( | |
| "controller", | |
| (ThrowingRunnable<Exception>) | |
| () -> k.getResponseSender().send(SUCCESS.getBody())))) | |
| .addExactPath( | |
| SUCCESS.rawPath(), | |
| exchange -> controller(SUCCESS, () -> { | |
| exchange.getResponseSender().send(SUCCESS.getBody()); | |
| return null; | |
| })) |
There was a problem hiding this comment.
i tries this in my second commits 98c5f08#diff-b3a26e2313b3c2d5656873760131d5794cccfdda0263105ad63b83527d623981R47
But the test case failed.
emmm, Let me try again...
| val latestDepTest = findProperty("testLatestDeps") as Boolean | ||
| if (latestDepTest) { | ||
| tasks.withType<JavaCompile>().configureEach { | ||
| options.release.set(11) |
There was a problem hiding this comment.
Curious why you would need to add this. In CI we run latest dep tests with java 21 so even if the undertow libs require java 11 it would work.
There was a problem hiding this comment.
It looks like the ci can not pass if i do not change the build.gradle.kts
I verify the test case by ./gradlew :instrumentation:undertow-1.4:javaagent:compileTestJava -PtestLatestDeps=true --debug local after i change the file.
I think though the jdk is 21, but the --release 8 is in compile args. So the feature on JDK9 can not be used.
this can ref spring-boot3 module. What do you think ? Or any other fix suggestion?
There was a problem hiding this comment.
use
if (latestDepTest) {
otelJava {
minJavaVersionSupported.set(JavaVersion.VERSION_11)
}
}| exchange.dispatch( | ||
| k -> | ||
| controller( | ||
| CAPTURE_HEADERS, |
There was a problem hiding this comment.
path and the endpoint used don't match
| exchange.dispatch( | ||
| k -> | ||
| controller( | ||
| CAPTURE_HEADERS, |
There was a problem hiding this comment.
path and the endpoint used don't match
related to #7195