Repository navigation
test(e2e): cover the hardening fixes at the layer that can falsify them - #1355
Merged
Merged
Conversation
Several fixes that landed today were guarded only by unit tests inside
`lib/`. The largest gap was the listener slab-slot lifetime change, which
altered all four protocols but shipped a reactivation test for TCP alone;
HTTP, HTTPS and UDP rested on the argument that the four arms are
equivalent. An argument is not a test.
Ten tests, each seen red by reverting the merged production hunk, then
restored and proven byte-identical:
- a reactivated listener still serves, for HTTP, HTTPS, TCP and UDP, with
traffic sent after the activation response is read so the inline accept
backlog cannot mask a deaf listener;
- three add/remove cycles at one UDP address leak no listener session;
- a forged PROXY-v2 LOCAL header cannot set the source address a TCP
session is charged against, and closes an expect_proxy HTTP session,
while a PROXY header carrying the same block is still honoured;
- a TCP cluster with expect_proxy survives a client that completes the
handshake and sends nothing;
- a --path-equals frontend is refused on re-add and stops routing when
removed;
- a listener answer template carrying an out-of-range status does not kill
the worker, and stays unselectable.
The UDP add/remove test stops the worker with `hard_stop`, deliberately:
under the mutation it is written to catch, a leaked listener session holds
the session count above zero and `soft_stop` never returns, which would hang
CI instead of reddening. The leak is observed before the stop either way.
Two bounds on what e2e can reach are now recorded in `e2e/COVERAGE.md` and
`doc/testing.md` rather than left to be rediscovered. `MultiLineWriter` is
constructed only by the `file://` logging backend, which the e2e harness
never selects. And `kawa_h1`'s status-metric path is unreachable from any
binary: neither `HttpStateMachine` nor `HttpsStateMachine` has a
`kawa_h1::Http` variant and `Http::new` has no caller, which a probe
confirmed by panicking on entry and never firing across four proxied
sessions while firing immediately in the function's own unit test.
A first attempt at covering that path passed with the production assertion
restored, so it was deleted rather than kept: a test that cannot fail is
worse than none. The reachable half of the same fix — a control-plane answer
template — is covered instead.
Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS
requested review from
Wonshtrum and
llenotre
as code owners
September 19, 2026 07:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests and documentation only — no production file is touched (
e2e/anddoc/, 1543 insertions,zero deletions).
Several fixes that landed today were guarded only by unit tests inside
lib/. The largest gap: thelistener slab-slot lifetime change altered all four protocols but shipped a reactivation test for
TCP alone. HTTP, HTTPS and UDP rested on the argument that the four arms are equivalent. An argument
is not a test.
Ten tests, each seen red
Every one was reddened by reverting the merged production hunk, then restored and proven
byte-identical.
after the activation response is read, so the inline
accept()backlog cannot mask a deaflistener.
LOCALheader cannot set the source address a TCP session is charged againstunder
max_connections_per_ip, and closes anexpect_proxyHTTP session — while aPROXYheadercarrying the same block is still honoured and injected as
X-Real-IP, proving the fix securesPROXY support rather than disabling it.
expect_proxysurvives a client that completes the handshake and sendsnothing, with a second session proving the worker is alive.
--path-equalsfrontend is refused on re-add and stops routing when removed.unselectable.
Two judgement calls worth knowing
hard_stopin the UDP add/remove test is deliberate. Under the mutation it exists to catch, aleaked listener session holds the session count above zero and
soft_stopnever returns — thetest would hang CI instead of reddening. The leak is observed before the stop either way.
The
--path-equalsred needsRUSTFLAGS="-C debug-assertions=off", becauseadd_tree_rule'spost-condition predates that fix and kills the worker at add time in a debug build, masking the
routing behaviour. The test is green by default in CI's ordinary configuration; the flag only isolates
which defect it demonstrates, and pins the release-binary behaviour where the
debug_assert!iscompiled out.
Two bounds on what e2e can ever reach
Now recorded in
e2e/COVERAGE.mdanddoc/testing.mdrather than left to be rediscovered:MultiLineWriteris unreachable from e2e. It is constructed at exactly one site, thefile://logging backend, and the harness hardcodes
stdoutwith no access-log target.kawa_h1's status-metric path is unreachable from any binary. NeitherHttpStateMachinenorHttpsStateMachinehas akawa_h1::Httpvariant, andHttp::newhas no caller. A probe confirmedit:
panic!planted at the function entry never fired across four real proxied HTTP/HTTPS sessions,while firing immediately in the function's own unit test — a positive control, so the negative means
something. See kawa_h1: is the Http session state machine still reachable in any binary? #1346.
A first attempt at covering that path passed with the production assertion restored, so it was
deleted rather than kept: a test that cannot fail is worse than none. The reachable half of the same
fix — a control-plane answer template — is covered instead.
Flake
10 isolated serial runs ×
repeat_until_error_or(3, ..)= 30 executions per test, all clean; plus twofull-suite runs at default parallelism in which all ten passed. Every new test allocates its ports
through the mutex-guarded registry, so the only literal addresses are synthetic ones inside forged
PROXY-v2 payloads, never bound.