Skip to content

Auto-port 5.0: Fix flaky HttpToHttp2ConnectionHandlerTest.testChunkedRequestWithBodyAndTrailingHeaders - #17592

Merged
normanmaurer merged 1 commit into
5.0from
auto-port-pr-17590-to-5.0
Sep 22, 2026
Merged

normanmaurer merged 1 commit into
5.0from
auto-port-pr-17590-to-5.0

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #17590 to 5.0
Cherry-picked commit: bb3eb5f


Motivation:

HttpToHttp2ConnectionHandlerTest.testChunkedRequestWithBodyAndTrailingHeaders
writes two HttpContent chunks for the same stream and asserted that
exactly one onDataRead(...) call was observed on the server side with
the two payloads concatenated into a single DATA frame. Whether the two
writeData(...) calls get merged into one physical DATA frame by
DefaultHttp2RemoteFlowController's pending-write-queue coalescing is a
timing-dependent internal optimization, not a guarantee of the codec.
When the merge does not happen in time, two separate DATA frames are
delivered instead, which is spec-compliant but failed the test's strict
Mockito verify(times(1)) expectation.

Modifications:

  • Verify onDataRead(...) is invoked atLeastOnce() instead of exactly
    once
  • Assert the concatenation of all received buffers matches the sent
    payload instead of assuming a single buffer

Result:

The test no longer depends on the timing of the flow controller's DATA
frame coalescing and reliably passes regardless of whether the two
chunks are delivered as one or two DATA frames.

…AndTrailingHeaders (#17590)

Motivation:

HttpToHttp2ConnectionHandlerTest.testChunkedRequestWithBodyAndTrailingHeaders
writes two HttpContent chunks for the same stream and asserted that
exactly one onDataRead(...) call was observed on the server side with
the two payloads concatenated into a single DATA frame. Whether the two
writeData(...) calls get merged into one physical DATA frame by
DefaultHttp2RemoteFlowController's pending-write-queue coalescing is a
timing-dependent internal optimization, not a guarantee of the codec.
When the merge does not happen in time, two separate DATA frames are
delivered instead, which is spec-compliant but failed the test's strict
Mockito verify(times(1)) expectation.

Modifications:

- Verify onDataRead(...) is invoked atLeastOnce() instead of exactly
  once
- Assert the concatenation of all received buffers matches the sent
  payload instead of assuming a single buffer

Result:

The test no longer depends on the timing of the flow controller's DATA
frame coalescing and reliably passes regardless of whether the two
chunks are delivered as one or two DATA frames.

(cherry picked from commit bb3eb5f)

@utafrali utafrali 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.

Focused, correct fix for a genuine flakiness source: the two writeData(...) calls can be coalesced into one DATA frame or arrive as two, and the test was asserting a timing-dependent coalescing outcome. Relaxing to atLeastOnce() and comparing concatenated payloads matches the codec's actual contract, and the change is consistent with the surrounding style in the file.

@testlens-app

testlens-app Bot commented Sep 22, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 4cb6fd6
▶️ Tests: 231561 executed
⚪️ Checks: 12/12 completed


Learn more about TestLens at testlens.app/docs.

@normanmaurer normanmaurer added this to the 5.0.0.Final milestone Sep 22, 2026
@normanmaurer

Copy link
Copy Markdown
Member

@utafrali please only add some review if its "meaningful". The whole text reads and looks like produced by AI only

@normanmaurer
normanmaurer merged commit 709eb20 into 5.0 Sep 22, 2026
13 checks passed
@normanmaurer
normanmaurer deleted the auto-port-pr-17590-to-5.0 branch September 22, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants