Skip to content

test(http2): expand http2_client.cpp coverage to 80% line / 70% branch #1062

Description

@kcenon

What

Expand unit-test coverage of src/protocols/http2/http2_client.cpp from 18.8% line / 9.9% branch to the project targets of >= 80% line / >= 70% branch, as measured by the existing coverage.yml workflow.

The file has ~576 executable lines (lcov). Existing tests in tests/test_http2_client.cpp (added via #991) cover happy paths only; this issue adds error-path and branch-coverage tests.

Why

Where

  • File: src/protocols/http2/http2_client.cpp (~1181 raw LOC, 576 lcov-executable)
  • Tests: extend tests/test_http2_client.cpp (do not fork a parallel suite)
  • Coverage workflow: .github/workflows/coverage.yml (all BUILD_WITH_* flags ON, branch coverage via lcov --rc lcov_branch_coverage=1)

How

Technical Approach

  1. Read http2_client.cpp / http2_client.h to enumerate public API and error branches.
  2. Use the 2026-04-26 lcov report to identify uncovered lines/branches.
  3. Add tests targeting:
    • Error paths (connection failures, frame parse errors, GOAWAY, RST_STREAM handling)
    • Boundary cases (max frame size, flow-control window edges, stream-ID exhaustion, header-table eviction triggered from client side)
    • State-machine transitions on closed/half-closed streams
  4. Reuse existing fixtures and the in-process loopback transport — do not mock the network stack.

Acceptance Criteria

  • src/protocols/http2/http2_client.cpp line coverage >= 80%
  • src/protocols/http2/http2_client.cpp branch coverage >= 70%
  • All new tests pass on Ubuntu/macOS/Windows CI
  • All sanitizer builds (ASAN, TSAN, UBSAN) pass
  • Post-merge coverage delta recorded as a comment on Expand unit test coverage from 40% to 80% #953

Part of #953

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions