Skip to content

Fix FilterProxyTest TCK test - #1068

Draft
graemerocher wants to merge 1 commit into
6.0.xfrom
graemerocher/issue-543-filter-proxy-test
Draft

Fix FilterProxyTest TCK test#1068
graemerocher wants to merge 1 commit into
6.0.xfrom
graemerocher/issue-543-filter-proxy-test

Conversation

@graemerocher

Copy link
Copy Markdown
Contributor

Summary

  • bridge streamed Netty proxy responses into a servlet ByteBody before generic encoding drops the body
  • re-enable FilterProxyTest in the Tomcat, Jetty, and Undertow TCK suites
  • keep the JDK suite excluded because self-proxying requests still time out there

Verification

  • ./gradlew spotlessApply :test-suite-http-server-tck-tomcat:test --tests io.micronaut.http.server.tck.tomcat.tests.TomcatHttpServerTestSuite :test-suite-http-server-tck-jetty:test --tests io.micronaut.http.server.tck.jetty.tests.JettyHttpServerTestSuite :test-suite-http-server-tck-undertow:test --tests io.micronaut.http.server.tck.undertow.tests.UndertowHttpServerTestSuite

Resolves #543

Co-Authored-By: Codex with GPT-5 <codex@openai.com>
@graemerocher graemerocher added the type: bug Something isn't working label Apr 30, 2026
@graemerocher graemerocher self-assigned this Apr 30, 2026
@graemerocher
graemerocher requested a review from Copilot April 30, 2026 15:21
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
33.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@graemerocher
graemerocher marked this pull request as draft April 30, 2026 15:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ServletHttpHandler to convert Netty StreamedHttpResponse into a servlet-friendly ByteBodyHttpResponse.
  • Re-enable FilterProxyTest in Tomcat, Jetty, and Undertow TCK suites.
  • Keep FilterProxyTest excluded 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something isn't working

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Fix FilterProxyTest TCK test

2 participants