Skip to content

infra(test): add COVERAGE_TIMEOUT_MULTIPLIER for hermetic_transport_fixture wait_for (Round 5, Part of #1106, #953) #1112

Description

@kcenon

What

Add a coverage-only wait_for timeout multiplier to tests/support/hermetic_transport_fixture.h so that Http2ClientHermeticTransportTest cases (and other hermetic-fixture users) can complete their SETTINGS handshake under -fprofile-arcs -ftest-coverage instrumentation. PR #1111 diagnosis confirmed all 7 Round-3 dispatcher TEST_F (and ~30 other fixture-based tests) FAILED at the wait_for(... settings_exchanged() ..., 3s) gate (5.1-5.4s observed under coverage vs 100-300ms in Debug/Release), producing 0pp delta on src/protocols/http2/http2_client.cpp for three consecutive rounds (PR #1108, PR #1109).

Change Type

  • Test infrastructure (fixture only; no src/ changes; no new TEST_F)

Affected Components

  • tests/support/hermetic_transport_fixture.h (introduce multiplier + apply to wait_for default and call sites)
  • tests/support/hermetic_transport_fixture.cpp (if any wait_for call sites live there)
  • tests/CMakeLists.txt or cmake/Coverage.cmake (define NETWORK_COVERAGE_TIMEOUT_MULTIPLIER=5 when NETWORK_COVERAGE_BUILD is ON; default 1 otherwise)

Why

Related Issues

Where

Path Role
tests/support/hermetic_transport_fixture.h Define NETWORK_COVERAGE_TIMEOUT_MULTIPLIER macro (default 1); apply inside wait_for(...) default-argument arithmetic (std::chrono::seconds(2) * NETWORK_COVERAGE_TIMEOUT_MULTIPLIER) and at every explicit wait_for(..., 3s) call site within the fixture/helper code.
tests/support/hermetic_transport_fixture.cpp Mirror multiplier at any explicit wait_for(..., Ns) call site (e.g. make_connected_client).
tests/CMakeLists.txt (or cmake/Coverage.cmake) Add target_compile_definitions(... PRIVATE NETWORK_COVERAGE_TIMEOUT_MULTIPLIER=5) when NETWORK_COVERAGE_BUILD is ON; otherwise set to 1 (or omit so the header default 1 applies).

No src/ changes. No new TEST_F. TEST_F additions are #1106 / #1107 territory and must wait until this fix lands and a measured coverage delta is verified.

How

Technical Approach

  1. In tests/support/hermetic_transport_fixture.h, add near the top of the header:
    #ifndef NETWORK_COVERAGE_TIMEOUT_MULTIPLIER
    #define NETWORK_COVERAGE_TIMEOUT_MULTIPLIER 1
    #endif
  2. Update the wait_for default-argument timeout to scale with the multiplier:
    std::chrono::milliseconds timeout = std::chrono::seconds(2) * NETWORK_COVERAGE_TIMEOUT_MULTIPLIER
  3. At every explicit wait_for(..., 3s) (or other literal-second) call site in the fixture and helpers (make_connected_client, etc.), multiply by NETWORK_COVERAGE_TIMEOUT_MULTIPLIER so the budget becomes 3s * 5 = 15s under coverage builds and stays 3s otherwise.
  4. In the build system, set NETWORK_COVERAGE_TIMEOUT_MULTIPLIER=5 when NETWORK_COVERAGE_BUILD is ON. Use the same target-scope compile definition mechanism that already gates the existing NETWORK_COVERAGE_BUILD macro so the multiplier is target-private to test binaries.
  5. Do NOT add or modify any TEST_F in this PR.

Acceptance Criteria

  • Macro NETWORK_COVERAGE_TIMEOUT_MULTIPLIER exists in tests/support/hermetic_transport_fixture.h, defaults to 1, set to 5 only under NETWORK_COVERAGE_BUILD.
  • Every wait_for(...) call site reachable from Http2ClientHermeticTransportTest (default-argument and explicit) scales its timeout by the multiplier.
  • Debug and Release matrix CI on the PR pass (no behaviour change off coverage; multiplier is 1).
  • Post-merge coverage workflow run (full lcov pipeline) on develop measures delta >= +20pp line AND >= +10pp branch on src/protocols/http2/http2_client.cpp versus the pre-merge sha. Reference baseline: 18.75% line (108/576), 9.91% branch (97/979) from PR test(http2): stabilize coverage and expand dispatcher branches (#1106) #1109 (sha d537864).
  • Post-merge coverage workflow run shows the previously-failing fixture sentinel (Http2ClientHermeticTransportTest.ConnectCompletesSettingsExchangeWithMockPeer) and the 7 Round-3 dispatcher TEST_F now PASS under instrumentation (per Run tests step stdout).
  • No new TEST_F introduced in this PR (zero additions to tests/unit/http2_client_branch_test.cpp and any other unit-test file).

Test Plan for Reviewers

  1. Inspect the wait_for call-site diff and confirm every literal-second budget scales with NETWORK_COVERAGE_TIMEOUT_MULTIPLIER.
  2. Verify the build-system change is scoped to test targets (not src/).
  3. After merge, trigger the coverage workflow on develop and check coverage_filtered.info for the post-merge LH/LF/BRH/BRF on src/protocols/http2/http2_client.cpp against the >= +20pp / >= +10pp gate.

Breaking Changes

None. Multiplier defaults to 1 outside coverage builds; observable behaviour in Debug/Release is unchanged.

Rollback

git revert is sufficient. Test infrastructure only; no production-source or schema changes.

Risks

  • The 7 dispatcher TEST_F may add 50+ s combined to the coverage workflow runtime when they actually complete (vs aborting at 5s today). Diagnosis explicitly accepts this trade-off.
  • If the post-merge coverage delta does not clear the >= +20pp / >= +10pp gate, do NOT close this issue or claim Round 5 success; reopen the diagnosis to investigate whether more call sites need the multiplier or whether Option C (friend-injected process_frame) is needed instead.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions