Fix FilterProxyTest TCK test - #1068
Draft
graemerocher wants to merge 1 commit into
Draft
Conversation
Co-Authored-By: Codex with GPT-5 <codex@openai.com>
|
graemerocher
marked this pull request as draft
April 30, 2026 15:33
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR fixes the FilterProxyTest TCK scenario for servlet-based servers by bridging Netty streamed proxy responses into a servlet ByteBody, and then re-enables the test across the Tomcat/Jetty/Undertow TCK suites while keeping it excluded for the JDK HTTP server suite due to timeouts.
Changes:
- Add adaptation logic in
ServletHttpHandlerto convert NettyStreamedHttpResponseinto a servlet-friendlyByteBodyHttpResponse. - Re-enable
FilterProxyTestin Tomcat, Jetty, and Undertow TCK suites. - Keep
FilterProxyTestexcluded for the JDK HTTP server suite with an updated exclusion rationale.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| test-suite-http-server-tck-undertow/.../UndertowHttpServerTestSuite.java | Re-enables FilterProxyTest for Undertow suite. |
| test-suite-http-server-tck-tomcat/.../TomcatHttpServerTestSuite.java | Re-enables FilterProxyTest for Tomcat suite. |
| test-suite-http-server-tck-jetty/.../JettyHttpServerTestSuite.java | Re-enables FilterProxyTest for Jetty suite. |
| test-suite-http-server-tck-jdk/.../HttpServerEmbeddedServerSuite.java | Keeps FilterProxyTest excluded with updated comment. |
| servlet-core/.../ServletHttpHandler.java | Adds Netty streamed response -> ByteBody adaptation. |
| servlet-core/build.gradle.kts | Adds Netty HTTP dependency needed by new adaptation logic. |
|
|
||
| dependencies { | ||
| api(mn.micronaut.http.server) | ||
| implementation(mn.micronaut.http.netty) |
Comment on lines
+85
to
+86
| private static final ByteBodyFactory STREAMING_BODY_FACTORY = ByteBodyFactory.createDefault(ByteArrayBufferFactory.INSTANCE); | ||
|
|
Comment on lines
+321
to
+331
| private @Nullable ByteBodyHttpResponse<?> adaptNettyStreamingResponse(HttpResponse<?> response) { | ||
| if (!(response instanceof NettyHttpResponseBuilder builder) || !builder.isStream()) { | ||
| return null; | ||
| } | ||
| StreamedHttpResponse streamedResponse = builder.toStreamHttpResponse(); | ||
| CloseableByteBody byteBody = STREAMING_BODY_FACTORY.adapt( | ||
| Flux.from(streamedResponse) | ||
| .doOnDiscard(HttpContent.class, ReferenceCountUtil::release) | ||
| .map(content -> { | ||
| try { | ||
| return ReadBufferFactory.getJdkFactory().copyOf(content.content().nioBuffer()); |
Comment on lines
+327
to
+335
| Flux.from(streamedResponse) | ||
| .doOnDiscard(HttpContent.class, ReferenceCountUtil::release) | ||
| .map(content -> { | ||
| try { | ||
| return ReadBufferFactory.getJdkFactory().copyOf(content.content().nioBuffer()); | ||
| } finally { | ||
| ReferenceCountUtil.release(content); | ||
| } | ||
| }), |
| @SuiteDisplayName("TCK for Built-in Java HTTP Server") | ||
| @ExcludeClassNamePatterns({ | ||
| "io.micronaut.http.server.tck.tests.FilterProxyTest", // see https://github.com/micronaut-projects/micronaut-core/issues/9725 | ||
| "io.micronaut.http.server.tck.tests.FilterProxyTest", // times out on self-proxying requests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Verification
Resolves #543