Repository navigation
Auto-port 5.0: Fix flaky HttpToHttp2ConnectionHandlerTest.testChunkedRequestWithBodyAndTrailingHeaders - #17592
Merged
Merged
Conversation
…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
approved these changes
Sep 22, 2026
utafrali
left a comment
There was a problem hiding this comment.
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.
✅ All tests passed ✅🏷️ Commit: 4cb6fd6 Learn more about TestLens at testlens.app/docs. |
Member
|
@utafrali please only add some review if its "meaningful". The whole text reads and looks like produced by AI only |
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.
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:
once
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.