Skip to content

test(support): add NETWORK_COVERAGE_TIMEOUT_MULTIPLIER for hermetic fixture wait_for#1113

Merged
kcenon merged 1 commit into
developfrom
infra/issue-1112-coverage-timeout-multiplier
May 8, 2026
Merged

test(support): add NETWORK_COVERAGE_TIMEOUT_MULTIPLIER for hermetic fixture wait_for#1113
kcenon merged 1 commit into
developfrom
infra/issue-1112-coverage-timeout-multiplier

Conversation

@kcenon

@kcenon kcenon commented May 8, 2026

Copy link
Copy Markdown
Owner

Closes #1112

What

Add coverage-only NETWORK_COVERAGE_TIMEOUT_MULTIPLIER to tests/support/hermetic_transport_fixture.h so Http2ClientHermeticTransportTest (and other hermetic-fixture users) complete the SETTINGS handshake under -fprofile-arcs -ftest-coverage. Round-5 structural fix per PR #1111 diagnosis.

Change Type

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

Affected Components

  • tests/support/hermetic_transport_fixture.h — define multiplier (default 1); apply to wait_for default-argument timeout.
  • tests/support/hermetic_transport_fixture.cpp — scale make_loopback_tcp_pair accept-handler deadline.
  • tests/support/CMakeLists.txt — define NETWORK_COVERAGE_TIMEOUT_MULTIPLIER=5 PUBLIC on network_test_support when ENABLE_COVERAGE is ON.

Why

PR #1111 diagnosis (docs/coverage/http2_client_round-4-diagnosis.md) 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. Three consecutive rounds (PR #1108 Round 2, PR #1109 Round 3) merged green in Debug/Release CI but produced exactly 0pp delta on src/protocols/http2/http2_client.cpp (still 18.75% line / 9.91% branch, byte-identical LH/LF/BRH/BRF). Without this structural fix, every future TEST_F added to exercise dispatcher branches will repeat the 0pp pattern.

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).
tests/support/hermetic_transport_fixture.cpp Scale the accept-handler deadline in make_loopback_tcp_pair by the multiplier.
tests/support/CMakeLists.txt Add target_compile_definitions(network_test_support PUBLIC NETWORK_COVERAGE_TIMEOUT_MULTIPLIER=5) when ENABLE_COVERAGE is ON. PUBLIC so test executables linking network::test_support inherit the macro at the point of header inclusion.

No src/ changes. No new TEST_F.

How

Implementation

  1. Header gates the macro behind #ifndef NETWORK_COVERAGE_TIMEOUT_MULTIPLIER ... #define ... 1 ... #endif so non-coverage TUs see the default 1.
  2. wait_for default-argument timeout becomes std::chrono::seconds(2) * NETWORK_COVERAGE_TIMEOUT_MULTIPLIER — outside coverage that resolves to 2s; under coverage it resolves to 10s.
  3. The cpp's make_loopback_tcp_pair deadline scales the same way.
  4. Build system sets NETWORK_COVERAGE_TIMEOUT_MULTIPLIER=5 PUBLIC on the network_test_support static lib only when ENABLE_COVERAGE is ON. PUBLIC propagates through target_link_libraries(... PRIVATE network::test_support) so consuming test executables compile fixture-using TUs with the same macro value.
  5. The fixture-wide wait_for(... settings_exchanged() ..., 3s) call sites in tests/unit/*_branch_test.cpp consume the scaled default; explicit-3s call sites are not modified in this PR (per issue scope discipline — the 3s explicit budgets are caller-provided constants that already exceed observed Debug/Release latency, and the issue's primary lever is the default-argument path that the dispatcher TEST_F use).

Testing Done

  • Local diff inspection: confirmed every fixture-internal literal-second budget scales with the multiplier.
  • Build-system change scoped to network_test_support (test target only); src/ and production targets are not touched.
  • Local toolchain (cmake/Ninja) is available but a full local build would require fetching vcpkg dependencies — relying on CI for the Debug/Release matrix verification.

Test Plan for Reviewers

  1. Inspect the wait_for default-argument diff and confirm it scales with NETWORK_COVERAGE_TIMEOUT_MULTIPLIER.
  2. Verify the build-system change is scoped to the test_support target (not src/ or production).
  3. Check Debug + Release matrix CI is green on the PR (multiplier is 1, no behaviour change).

Acceptance Criteria

  • Macro NETWORK_COVERAGE_TIMEOUT_MULTIPLIER exists in tests/support/hermetic_transport_fixture.h, defaults to 1, set to 5 only when ENABLE_COVERAGE is ON.
  • Every fixture-internal wait_for(...) budget reachable via the default argument scales with the multiplier; make_loopback_tcp_pair accept-handler deadline scales likewise.
  • Debug and Release matrix CI on the PR pass (no behaviour change off coverage).
  • POST-MERGE — coverage workflow on develop measures >= +20pp line AND >= +10pp branch on src/protocols/http2/http2_client.cpp vs pre-merge sha (baseline: 18.75% line (108/576), 9.91% branch (97/979) from PR test(http2): stabilize coverage and expand dispatcher branches (#1106) #1109 sha d5378644). Cannot be validated in PR-time CI — PR-time matrix is Debug/Release only. Verified by the post-merge coverage workflow on develop.
  • POST-MERGE — Round-3 dispatcher TEST_F (Http2ClientHermeticTransportTest.ConnectCompletesSettingsExchangeWithMockPeer plus the 7 dispatcher cases) PASS under instrumentation. Verified post-merge by the coverage workflow.
  • No new TEST_F introduced in this PR.

Breaking Changes

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

Rollback

git revert is sufficient. Test infrastructure only.

Risks

…ixture

Scale every hermetic-fixture wait_for budget by NETWORK_COVERAGE_TIMEOUT_MULTIPLIER
so Http2ClientHermeticTransportTest dispatcher cases can complete the 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 wait_for(settings_exchanged(), 3s): 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 rounds (PR #1108, PR #1109).

Changes:
- tests/support/hermetic_transport_fixture.h: define
  NETWORK_COVERAGE_TIMEOUT_MULTIPLIER (default 1), apply to wait_for default
  timeout argument.
- tests/support/hermetic_transport_fixture.cpp: scale make_loopback_tcp_pair
  accept-handler deadline by the multiplier.
- tests/support/CMakeLists.txt: define
  NETWORK_COVERAGE_TIMEOUT_MULTIPLIER=5 on network_test_support PUBLIC when
  ENABLE_COVERAGE is ON, so all consuming test executables inherit it at the
  point of header inclusion.

No src/ changes. No new TEST_F. Multiplier defaults to 1 outside coverage
builds; Debug/Release matrix observable behaviour is unchanged.

Closes #1112
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Metric Value
Line Coverage 69.3%
Branch Coverage 34.5%
Target 80% lines / 70% branches
Coverage Details

Full HTML report is available as a build artifact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant