Skip to main content

Module differential

Module differential 

Source
Expand description

Reusable differential test harness for comparing eggress with Python pproxy.

All tests using this harness are gated on EGGRESS_RUN_PPROXY_DIFFERENTIAL=1 and require Python 3 with pproxy installed (pip install pproxy==2.7.9).

§Usage

use eggress_testkit::differential::*;

require_differential_gate();

let (echo_addr, echo_jh) = eggress_testkit::start_echo_server().await;
let mut pproxy = start_pproxy_server("socks5", 1080).await;
// ... run tests ...
pproxy.kill();
echo_jh.abort();

Structs§

ProcessGuard
RAII guard that kills a child process on drop.

Constants§

GATE_VAR
Environment variable that gates differential tests.
LEGACY_PYTHON_VAR
Legacy environment variable for the Python binary path.
ORACLE_PYTHON_VAR
Canonical environment variable for the oracle Python interpreter.
PINNED_PPROXY_VERSION
Pinned pproxy version for reproducible test results.
PYTHON_BIN_VAR
Deprecated alias — prefer ORACLE_PYTHON_VAR or LEGACY_PYTHON_VAR.

Functions§

assert_coarse_failure_equivalence
Assert coarse failure equivalence: both succeeded or both failed.
assert_port_ready
Assert that a port becomes reachable within the timeout.
build_socks5_udp_packet
Build a SOCKS5 UDP datagram with an IPv4 or IPv6 target.
build_socks5_udp_packet_domain
Build a SOCKS5 UDP datagram with a domain target.
build_socks5_udp_packet_frag
Build a SOCKS5 UDP datagram with a custom FRAG field.
compare_tcp_echo
Compare two TCP echo results.
compare_udp_echo
Compare two UDP echo results.
differential_gate_enabled
Check if the differential test gate is enabled.
extract_http_body
Extract the body from an HTTP response (after the first \r\n\r\n).
extract_http_status
Extract the HTTP status code from a response (e.g., “200” from “HTTP/1.1 200 OK”).
extract_udp_payload
Extract the payload from a SOCKS5 UDP datagram.
find_oracle_python
Find the oracle Python interpreter with version validation.
find_python_binary
Find a working Python binary that has pproxy installed.
read_with_timeout
Read all available data from an AsyncRead within a timeout.
recv_udp_response
Receive a UDP response with a timeout.
require_differential_gate
Require the differential gate to be enabled.
start_pproxy_server
Start a pproxy server with the given protocol and port.
start_pproxy_server_with_auth
Start a pproxy server with username/password authentication.
start_pproxy_with_args
Start a pproxy server with arbitrary CLI arguments.
start_udp_echo
Start a UDP echo server that echoes received packets back to the sender.
wait_for_port
Wait for a TCP port to become reachable.