Skip to content

test: expand coverage for src/protocols/quic/connection.cpp #990

Description

@kcenon

Part of #953

What

Raise line coverage of src/protocols/quic/connection.cpp from 29.2% to >= 70%, and branch coverage from 17.5% to >= 60%.

Current state (2026-04-17 measurement, source PR #989):

  • Instrumented lines: 716 / ~1584 LOC
  • Lines hit: 209 / 716 (29.2%)
  • Branches: 175 / 999 (17.5%)
  • Existing tests: tests/unit/quic_connection_test.cpp — 529 LOC, 42 GTEST cases

The file is the largest uncovered implementation unit in the project. 42 existing test cases only exercise 29.2% of lines, indicating shallow coverage along the main path with most state-machine branches and error-handling branches unreached.

Why

  • connection.cpp is core QUIC transport logic. Regressions here surface as subtle wire-level bugs that are expensive to diagnose in production.
  • Largest single gap against the v1.0 80% line / 70% branch targets tracked in Expand unit test coverage from 40% to 80% #953.
  • Result<T> migration in this area (per project status ~75-80% complete) needs safety-net tests before the remaining migrations land.

Where

  • Source: src/protocols/quic/connection.cpp
  • Header: include/kcenon/network/.../connection.h (verify exact path during implementation)
  • Existing tests to extend: tests/unit/quic_connection_test.cpp
  • Possibly add: tests/unit/quic_connection_state_test.cpp (state transitions), tests/unit/quic_connection_error_test.cpp (error paths)

How

Approach

  1. Run gcovr --show-branches or open coverage_html/src/protocols/quic/connection.cpp.gcov.html from PR ci(coverage): enable messaging_bridge in coverage build #989's coverage artifact to pinpoint uncovered blocks.
  2. Group uncovered regions into: (a) state-machine transitions, (b) error/timeout paths, (c) frame-type dispatch branches.
  3. Add test cases per group, preferring table-driven parameterized tests where possible.

Acceptance Criteria

  • src/protocols/quic/connection.cpp line coverage >= 70%
  • src/protocols/quic/connection.cpp branch coverage >= 60%
  • New tests added to tests/unit/quic_connection_*.cpp (one file or multiple)
  • All existing tests still pass on Ubuntu/macOS CI
  • ASAN/TSAN/UBSAN all green on the new tests
  • No regressions in neighbouring files (other QUIC files within +/- 2pp)

Out of Scope

  • Rewriting connection.cpp itself. Implementation changes should be opened as a separate issue.
  • Coverage of protocol interop (that belongs in integration_tests/, not this issue).

Dependencies

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions