Files
leaf/leaf-e2e/tests
eric b70eaa705a test(e2e): add the end-to-end suite for the plugin host
`leaf-e2e` starts real leaf instances and drives them from the outside over
SOCKS5, so a case covers the path a deployment takes -- config parsing, plugin
loading, routing, the dispatcher, the C ABI data plane -- and nothing reaches
into leaf to build a handler by hand. Cases are values rather than `#[test]`
functions, so the suite is a matrix of implementation, protocol, transport and
behaviour instead of a wall of copies, and each runs in its own process, free
to crash, hang, or set load-time environment.

The lanes:

- `differential` runs a behaviour natively and again with a plugin substituted
  for one stage, and requires the two to agree. The server is stock leaf, so
  these are interoperability tests. `protocols`, `halfclose` and `teardown`
  extend that across every stack, relay and selector, the end of a request on
  each transport, and shutdown.
- `abi`, `loader` and `coexist` check what the host accepts, refuses, and can
  load at once, through a real `dlopen`.
- `hostile` and `datagram` drive conformance plugins -- one in Rust, one in Go
  -- that misbehave on request, exercising the host's bounds checks, clamps,
  buffer growth and `decode_packet` handling.
- `stress` and the meters measure both sides back to back and assert the ratio,
  since absolute numbers from a shared runner say little; throughput, latency,
  setup cost and cpu cost land in `meters.json` beside the case logs. What the
  process is holding is asserted directly instead, against the case's own
  allocator, because what matters there is that it stopped growing.
- `blackbox` runs the shipped binary: on a config file, and on a plugin
  library through `--verify-plugin`, whose report has to agree with what the
  loader itself would do.

Plugins are built by the harness, and a case whose toolchain is missing is
reported as ignored with the reason; `--strict`, which CI passes, makes that a
failure, so the suite cannot go green by running nothing. The suite runs on
Windows too, where a pause is never shorter than 16ms and cases that dribble
bytes bound their pauses instead.
2026-09-10 17:59:49 +08:00
..