Skip to content

test(e2e): clarify repeat_until_error_or is a stability check, not a retry - #1431

Merged
FlorentinDUBOIS merged 1 commit into
mainfrom
fix/e2e-repeat-semantics
Sep 22, 2026
Merged

FlorentinDUBOIS merged 1 commit into
mainfrom
fix/e2e-repeat-semantics

Conversation

@FlorentinDUBOIS

Copy link
Copy Markdown
Collaborator

repeat_until_error_or(n, ..) loops WHILE the inner test keeps returning
State::Success and returns Fail on the first bad trial, so it requires
n consecutive clean runs. The name reads like a retry helper, and the
old failure message ("Test not successful after: 3 iterations") read as
an exhausted retry budget rather than "the third of n iterations failed".

  • Document the real semantics on the function's doc comment, including
    how to choose n (a timing/race property that must hold every run wants
    several consecutive passes; a property one clean delivery already
    proves gets no extra assurance from repeating it).
  • Put all three outcome lines in one "stability check" vocabulary, so one
    grep over a run log finds the passes as well as the failures. The
    success line no longer reads "Test successful after: N iterations",
    which is the very phrasing this change argues against; a log filter on
    "Test successful after" therefore stops matching and has to become
    "stability check".
  • Make the wording true at n == 1. One run is not a consecutiveness
    property, so the four live n = 1 sites (two in
    redirect_rewrite_auth_tests.rs, two in h2_tests.rs) now end their FAIL
    and INTERRUPTED lines with "(a single clean run is required)" and
    report "stability check PASSED: the single required run succeeded" on
    the pass line, instead of the false and ungrammatical "(1 consecutive
    successes are required)".
  • Unit-test the loop, not only the strings. The body moved into a private
    run_stability_check returning (State, String). The extraction itself
    changes nothing observable -- same public signature, same three prints
    in the same order, same separator; the outcome lines change for the
    vocabulary reason above, not because of the extraction. Message-only
    tests could not catch a regression in the loop: 0..times in place of
    1..=times, or the (iteration, total) arguments swapped, left them
    green. The tests now drive the real loop, and both injections turn them
    red.
  • The coverage stops at run_stability_check, and that boundary is
    measured rather than assumed: fully reversing the printing wrapper's
    three prints leaves the suite at "7 passed; 0 failed", so a print
    reordering is still undetectable. Capturing stdout would need a new
    dependency or a writer parameter threaded through a helper with 402
    call sites; neither is worth six lines of printing, so the gap is
    recorded rather than claimed away.
  • Fix the prose that misread the helper. e2e/COVERAGE.md described
    repeat_until_error_or(2, ...) as making "a single transient failure
    surface as a stable fail" via a "retry budget", and
    doc/upgrade_e2e_tests.md said the six upgrade tests "all use
    repeat_until_error_or(10, ...) to account for timing sensitivity" --
    ten required consecutive runs multiply that exposure rather than
    absorbing it. doc/testing.md, CLAUDE.md and CONTRIBUTING.md each
    recommended the helper without saying what it does.

Keep the name. Measured on this tree, grep -rno 'repeat_until_error_or('
over e2e/src/tests/ minus mod.rs yields 403 occurrences, one of which is
the commented-out test_issue_808 body, leaving 402 real call sites across
29 files. That is the edit surface, not the runtime count: four of the
402 sit in the protocol_pair_matrix! macro body, which is invoked six
times, so 422 calls exist after expansion. The n distribution over real
calls is 5x144, 3x117, 10x74, 2x51, 100x12 and 1x4. A mechanical rename
of 402 sites is worse than the confusion it fixes. A #[deprecated] alias
forwarding to a correctly-named function was also considered, and
rejected on a blocker rather than on taste: .github/workflows/ci.yml:158
runs cargo clippy --all-targets --locked ${{ matrix.flags }} -- -D warnings, gated one line above on matrix.toolchain == '1.93.1', so six
of the nine matrix cells lint and stable/beta/nightly do not. -D warnings
implies -D deprecated, e2e is a workspace member, and --all-targets is
the part that makes it bite, because the call sites live under e2e's
#[cfg(test)] mod tests (e2e/src/lib.rs) and are compiled only by the test
targets. The alias would turn all 402 call sites into hard CI errors on
the commit introducing it. It stays available as the step after a rename,
not before.

No call site's n was changed: choosing a different n changes what a test
asserts and belongs to whoever owns that test. Several sites -- the seven
TLS cert/cipher smoke tests at n = 100 in e2e/src/tests/tests.rs, and the
six upgrade tests at n = 10 -- look like a single clean run would already
prove the property, and are left for a maintainer decision. Call sites
that already reasoned in stability-check terms keep what is local to
them and defer the rule itself: the n = 1 note on
test_h2_settings_flood_triggers_goaway (h2_tests.rs) records an observed
CI flake on its second iteration and states no general rule, so it is
left verbatim, while the comment on
test_tls_socket_log_peer_is_the_advertised_client
(socket_log_context_tests.rs) did restate the rule and now points at the
helper's doc for it, keeping the two fixed sleeps, the is_empty() arm
they can trip, and the 12/12 measurement. Neither n is changed.

Refs #1410

Signed-off-by: Florentin Dubois [email protected]

…retry

repeat_until_error_or(n, ..) loops WHILE the inner test keeps returning
State::Success and returns Fail on the first bad trial, so it requires
n *consecutive* clean runs. The name reads like a retry helper, and the
old failure message ("Test not successful after: 3 iterations") read as
an exhausted retry budget rather than "the third of n iterations failed".

- Document the real semantics on the function's doc comment, including
  how to choose n (a timing/race property that must hold every run wants
  several consecutive passes; a property one clean delivery already
  proves gets no extra assurance from repeating it).
- Put all three outcome lines in one "stability check" vocabulary, so one
  grep over a run log finds the passes as well as the failures. The
  success line no longer reads "Test successful after: N iterations",
  which is the very phrasing this change argues against; a log filter on
  "Test successful after" therefore stops matching and has to become
  "stability check".
- Make the wording true at n == 1. One run is not a consecutiveness
  property, so the four live n = 1 sites (two in
  redirect_rewrite_auth_tests.rs, two in h2_tests.rs) now end their FAIL
  and INTERRUPTED lines with "(a single clean run is required)" and
  report "stability check PASSED: the single required run succeeded" on
  the pass line, instead of the false and ungrammatical "(1 consecutive
  successes are required)".
- Unit-test the loop, not only the strings. The body moved into a private
  run_stability_check returning (State, String). The extraction itself
  changes nothing observable -- same public signature, same three prints
  in the same order, same separator; the outcome lines change for the
  vocabulary reason above, not because of the extraction. Message-only
  tests could not catch a regression in the loop: 0..times in place of
  1..=times, or the (iteration, total) arguments swapped, left them
  green. The tests now drive the real loop, and both injections turn them
  red.
- The coverage stops at run_stability_check, and that boundary is
  measured rather than assumed: fully reversing the printing wrapper's
  three prints leaves the suite at "7 passed; 0 failed", so a print
  reordering is still undetectable. Capturing stdout would need a new
  dependency or a writer parameter threaded through a helper with 402
  call sites; neither is worth six lines of printing, so the gap is
  recorded rather than claimed away.
- Fix the prose that misread the helper. e2e/COVERAGE.md described
  repeat_until_error_or(2, ...) as making "a single transient failure
  surface as a stable fail" via a "retry budget", and
  doc/upgrade_e2e_tests.md said the six upgrade tests "all use
  repeat_until_error_or(10, ...) to account for timing sensitivity" --
  ten required consecutive runs multiply that exposure rather than
  absorbing it. doc/testing.md, CLAUDE.md and CONTRIBUTING.md each
  recommended the helper without saying what it does.

Keep the name. Measured on this tree, grep -rno 'repeat_until_error_or('
over e2e/src/tests/ minus mod.rs yields 403 occurrences, one of which is
the commented-out test_issue_808 body, leaving 402 real call sites across
29 files. That is the edit surface, not the runtime count: four of the
402 sit in the protocol_pair_matrix! macro body, which is invoked six
times, so 422 calls exist after expansion. The n distribution over real
calls is 5x144, 3x117, 10x74, 2x51, 100x12 and 1x4. A mechanical rename
of 402 sites is worse than the confusion it fixes. A #[deprecated] alias
forwarding to a correctly-named function was also considered, and
rejected on a blocker rather than on taste: .github/workflows/ci.yml:158
runs `cargo clippy --all-targets --locked ${{ matrix.flags }} -- -D
warnings`, gated one line above on matrix.toolchain == '1.93.1', so six
of the nine matrix cells lint and stable/beta/nightly do not. -D warnings
implies -D deprecated, e2e is a workspace member, and --all-targets is
the part that makes it bite, because the call sites live under e2e's
#[cfg(test)] mod tests (e2e/src/lib.rs) and are compiled only by the test
targets. The alias would turn all 402 call sites into hard CI errors on
the commit introducing it. It stays available as the step after a rename,
not before.

No call site's n was changed: choosing a different n changes what a test
asserts and belongs to whoever owns that test. Several sites -- the seven
TLS cert/cipher smoke tests at n = 100 in e2e/src/tests/tests.rs, and the
six upgrade tests at n = 10 -- look like a single clean run would already
prove the property, and are left for a maintainer decision. Call sites
that already reasoned in stability-check terms keep what is local to
them and defer the rule itself: the n = 1 note on
test_h2_settings_flood_triggers_goaway (h2_tests.rs) records an observed
CI flake on its second iteration and states no general rule, so it is
left verbatim, while the comment on
test_tls_socket_log_peer_is_the_advertised_client
(socket_log_context_tests.rs) did restate the rule and now points at the
helper's doc for it, keeping the two fixed sleeps, the is_empty() arm
they can trip, and the 12/12 measurement. Neither n is changed.

Refs #1410

Signed-off-by: Florentin Dubois <[email protected]>
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