Skip to content

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

Description

@kcenon

What

Expand unit-test coverage of src/protocols/http2/http2_server.cpp from 38.3% line / 19.4% branch to >= 80% line / >= 70% branch (per coverage.yml).

Existing tests in tests/test_http2_server.cpp (added via #992) cover happy paths only; this issue adds error-path and branch-coverage tests.

Why

Where

  • File: src/protocols/http2/http2_server.cpp (~554 lcov-executable lines)
  • Tests: extend tests/test_http2_server.cpp
  • Coverage workflow: .github/workflows/coverage.yml

How

Technical Approach

  1. Read http2_server.cpp / http2_server.h to enumerate handler entry points and error branches.
  2. Use the 2026-04-26 lcov report for uncovered lines/branches.
  3. Add tests for:
    • Connection preface validation failures
    • Frame parse errors (malformed HEADERS, unexpected SETTINGS, oversize PUSH_PROMISE)
    • Flow-control window violations and PROTOCOL_ERROR paths
    • Stream-state machine transitions (idle → reserved → half-closed → closed)
  4. Use the in-process loopback transport; no network mocks.

Acceptance Criteria

  • src/protocols/http2/http2_server.cpp line coverage >= 80%
  • src/protocols/http2/http2_server.cpp branch coverage >= 70%
  • Tests pass on Ubuntu/macOS/Windows CI
  • Sanitizer builds (ASAN, TSAN, UBSAN) pass
  • Post-merge coverage delta recorded 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