Skip to content

test(e2e): cover TCP and UDP lifecycle boundaries - #1849

Merged
FlorentinDUBOIS merged 1 commit into
mainfrom
fix/tcp-udp-lifecycle-e2e
Oct 4, 2026
Merged

FlorentinDUBOIS merged 1 commit into
mainfrom
fix/tcp-udp-lifecycle-e2e

Conversation

@FlorentinDUBOIS

Copy link
Copy Markdown
Collaborator

Problem

Sōzu's TCP and UDP lifecycle behavior was implemented but lacked end-to-end regression coverage at the boundaries where old resources coexist with replacement configuration. This left half-close draining, all three PROXY roles, labelled metrics incarnation fencing, and UDP flow ownership dependent on unit-level or indirect evidence.

Resulting behavior covered

  • A TCP client half-closes after sending 256 KiB. Sōzu drains the exact request before closing the old session, then a caller-opened fresh connection exchanges an exact request and response without replaying old bytes. The old connection has no response guarantee.
  • The same scenario exercises plain TCP and PROXY Expect, Relay, and Send modes. Expect consumes the exact incoming PPv2 header, Relay preserves it byte-for-byte, and Send synthesizes the exact header from the accepted client and listener addresses.
  • A real old TCP session cannot decrement the labelled connection gauge of a replacement using the same cluster id, backend id, and address. Proxy-wide gauges still observe the old close, and a causally later replacement response proves forward progress.
  • RemoveCluster stops new UDP admission without closing an established flow. A replacement client opens a concurrent flow, idle expiry releases both connected upstream sockets, and the original client then creates a fresh flow. Counters move from (2 created, 2 evicted, 0 active) to (3, 2, 1) on reopen; the test does not assume the kernel chooses a never-before-used ephemeral port after all prior sockets are closed.

doc/testing.md records the focused commands and the TCP/UDP lifecycle distinction.

Validation

  • Independent review accepted the exact final patch with no remaining findings.
  • The final UDP oracle passed 1/1 under crypto-ring, with three successful internal repetitions; the controlled mutation that closes flows on RemoveCluster failed 0/1 and the restored code passed again.
  • Before the one-line review correction removed the invalid post-expiry port-uniqueness assertion, all three focused tests passed under crypto-ring, crypto-aws-lc-rs, crypto-openssl, and fips. The correction retains every protocol, resource, metric, and coexistence witness.
  • Controlled mutations independently made the TCP drain, TCP metrics fencing, and UDP preserved-flow tests fail, then restoration returned them to green.
  • cargo +nightly fmt --all -- --check, repository Clippy with opentelemetry,splice,simd, documentation citations, and scope checks passed. Full workspace and E2E suites remain CI gates.

Closes #1823

Refs #1840

@FlorentinDUBOIS
FlorentinDUBOIS merged commit 0f28147 into main Oct 4, 2026
28 checks passed
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.

Drain readable PROXY protocol bytes before handling a client half-close

1 participant