test(http2): expand http2_client.cpp coverage#1068
Merged
Conversation
Add 30 unit tests covering reachable paths in http2_client without a connected HTTP/2 server: - http2_response::get_header case folding and empty-name edges - http2_response::get_body_string binary, null, large payloads - Constructor variations (empty / long / special-char client_id) - connect() boundary inputs (whitespace host, port zero) - disconnect() lifecycle idempotency (triple, after failed connect) - set_settings boundary values (zero, uint32 max, push toggle) - Request and stream methods in disconnected state with empty paths, empty bodies, null callbacks, and stream_id 0 - Multi-instance settings isolation - http2_stream::window_size boundary values Coverage of post-handshake code paths (frame I/O, stream state machine, HPACK encode/decode against a peer) requires an in-process HTTP/2 loopback fixture and is tracked separately under #953. Part of #1062 Part of #953
Contributor
Coverage Report
Coverage DetailsFull HTML report is available as a build artifact. |
This was referenced Apr 27, 2026
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.
What
Add 30 focused unit tests to
tests/test_http2_client.cppthat exercise reachable code paths insrc/protocols/http2/http2_client.cppwithout an established HTTP/2 connection.Change Type
Affected Components
tests/test_http2_client.cpp— +319 LOC, +30 test cases (no source/build changes)Why
Part of #1062(and the parent epicPart of #953) — push narrow test-expansion across worst-coverage protocol files.Pre-PR baseline (2026-04-26 lcov):
http2_client.cpp18.8% line / 9.9% branch. Existing tests (#991) cover happy paths only; this PR fills in error-path and boundary cases for the surface that does not require a live HTTP/2 server.Where
http2_response::get_headercase folding + empty-namehttp2_response::get_body_stringbinary/null/largeconnect()boundary inputsdisconnect()lifecycle idempotencyset_settingsboundary valueshttp2_stream::window_sizeHow
Implementation Approach
tests/test_http2_client.cpp(no parallel suite)Http2ClientTestGTest fixture for stateful testsTEST(...)for stateless struct-only and multi-instance tests<cstdint>and<limits>to the test-file includesCoverage Scope (Honest Assessment)
This PR does not reach the
>=80% line / >=70% branchacceptance criteria of #1062. The remaining gap is concentrated in the post-handshake code (frame I/O loop, stream-state transitions, HPACK encode/decode against a real peer). Those paths require an in-process HTTP/2 loopback fixture that does not currently exist in the test tree — theDISABLED_ConnectToHttpbinintegration test connects to the public internet, which is unsuitable for CI coverage.Building the loopback fixture is a larger, separate piece of work (TLS context with self-signed cert, ALPN h2 negotiation, server-side frame handling) and is tracked under #953. This PR therefore uses
Part of #1062rather thanCloses #1062and the issue stays open.Test Plan
Breaking Changes
None — test-only addition.
Rollback Plan
Revert this single commit; no schema, ABI, or build surface affected.
Part of #1062
Part of #953