flake: test_no_delay: reduce expected_saving threshold to fix probe variance
What changed, and why it matters
This commit only adjusts a threshold inside a single automated test. It makes a timing assertion more lenient so that random network-measurement noise does not cause false test failures. There is no change to production code, no user-facing behavior change, and no security relevance.
No security action needed. Treat as a normal test-flake fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies tests/test_connection.py::test_no_delay. It divides expected_saving by 2 in the assertion normal_time < nagle_time - expected_saving / 2. The stated reason is that the 10-sample probe used to estimate per-RTT Nagle delay can overestimate by about 2x compared with a 100-trip run, causing flaky failures despite TCP_NODELAY working correctly. The change is purely test-tolerance tuning.
Changed components
tests/test_connection.pyInspect captured patch +4 / −2
diff --git a/tests/test_connection.py b/tests/test_connection.py
index b65b5956..1a2a960f 100644
--- a/tests/test_connection.py
+++ b/tests/test_connection.py
@@ -4704,8 +4704,10 @@ def test_no_delay(node_factory):
f"expected saving {expected_saving:.2f}s")
if expected_saving > 0.5:
- # Platform shows a meaningful Nagle effect: assert the full saving.
- assert normal_time < nagle_time - expected_saving
+ # Platform shows a meaningful Nagle effect: assert at least half the saving.
+ # The 10-sample probe can overestimate per-RTT delay by ~2x due to variance,
+ # so apply an extra safety factor here.
+ assert normal_time < nagle_time - expected_saving / 2
else:
# Platform Nagle delay is too small to measure reliably (e.g. macOS);
# just assert that disabling Nagle is not slower.
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.