test: prefer real server for compliant peers #89

Merged
Lochnair merged 2 commits from test/real-server-peers into main 2026-08-14 11:25:24 +00:00
Lochnair commented 2026-08-14 10:22:43 +00:00 (Migrated from github.com)

Summary

  • Normal compliant irtt-client and irtt-cli tests now preferentially use the production in-tree irtt-server instead of hand-written fake server behavior.
  • Narrow fake/raw peers remain for adversarial, malformed, exact-packet, and deterministic timing scenarios.
  • The external upstream executable backend remains available for explicitly selected cross-implementation validation and is not used by ordinary test runs.

Test architecture

  • Production irtt-server: normal compliant behavior over real UDP.
  • Narrow fake/raw peer: deliberately invalid behavior or tightly controlled packet/timing behavior.
  • External upstream executable: explicit cross-implementation interoperability.

Both client and CLI fixtures run one production Server on a dedicated thread with a current-thread Tokio runtime, a bounded startup handshake, caller-controlled oneshot shutdown, and joined cleanup.

Migrated coverage

  • Protocol-option backend smoke for normal open/echo/close, ReceivedStats, StampAt, and Clock modes.
  • Normal authenticated HMAC success and authentication-required rejection smoke.
  • Valid ServerFill negotiation and echo operation.
  • Normal large-packet exchange.
  • Normal blocking/AsyncClient authenticated lifecycle and no-test equivalence.
  • Normal CLI single-target table/labeled output and healthy multi-target CSV output.

Retained fake coverage

  • Malformed or bad-HMAC open and echo replies.
  • Missing/wrong authentication request observation.
  • Silent peers, retries, timeouts, loss, and late replies.
  • Exact timestamps, packet sizes, flags, tokens, sequences, and request construction.
  • Duplicate, reordered, unsolicited, wrong-token, and classification cases.
  • Peer-close synchronization, gated reply release, interruption races, queued-row draining, and deliberate open failures.

Dependency boundary

  • irtt-server and the Tokio runtime used by fixtures are test/dev-only dependencies where added.
  • The no-default irtt-client normal dependency tree remains Tokio-free and irtt-server-free.
  • The client-only CLI production tree does not gain irtt-server.

Cleanup

  • Removed the hand-written fake as the default backend and removed obsolete normal echo helper paths from AsyncClient and CLI tests.
  • Retained the shared integration support dead-code allowance because separate integration targets intentionally consume different subsets, including the explicitly selected external backend.
  • Added two small 74-line production-server lifecycle owners. The overall test-code diff is +153 lines, while removing approximately three compliant fake helper paths and the fake default backend branch; the maintenance gain is deletion of duplicated normal protocol semantics rather than a target LOC reduction.

Scope

  • No production protocol, client, CLI, or server behavior changed.
  • No production test-only hooks were added.
  • No upstream source, tests, or history were inspected.
  • Ordinary CI has no automatic dependency on an external upstream executable.

Verification

  • cargo fmt --all -- --check
  • cargo check --workspace --all-targets --all-features --locked
  • cargo test --workspace --all-targets --all-features --locked
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features --no-deps
  • cargo test -p irtt-client --locked
  • cargo test -p irtt-client --all-features --locked
  • cargo check -p irtt-client --no-default-features --lib --locked
  • cargo clippy -p irtt-client --all-targets --all-features --locked -- -D warnings
  • cargo test -p irtt-cli --locked
  • cargo test -p irtt-cli --all-features --locked
  • cargo test -p irtt-cli --test client_multi_target --all-features --locked
  • cargo test -p irtt-cli --no-default-features --features client --locked
  • cargo check -p irtt-cli --no-default-features --all-targets --locked
  • cargo check -p irtt-cli --no-default-features --features client --all-targets --locked
  • Normal dependency-tree audits for no-default irtt-client and client-only irtt-cli.
  • git diff --check main...HEAD
## Summary - Normal compliant `irtt-client` and `irtt-cli` tests now preferentially use the production in-tree `irtt-server` instead of hand-written fake server behavior. - Narrow fake/raw peers remain for adversarial, malformed, exact-packet, and deterministic timing scenarios. - The external upstream executable backend remains available for explicitly selected cross-implementation validation and is not used by ordinary test runs. ## Test architecture - Production `irtt-server`: normal compliant behavior over real UDP. - Narrow fake/raw peer: deliberately invalid behavior or tightly controlled packet/timing behavior. - External upstream executable: explicit cross-implementation interoperability. Both client and CLI fixtures run one production `Server` on a dedicated thread with a current-thread Tokio runtime, a bounded startup handshake, caller-controlled oneshot shutdown, and joined cleanup. ## Migrated coverage - Protocol-option backend smoke for normal open/echo/close, ReceivedStats, StampAt, and Clock modes. - Normal authenticated HMAC success and authentication-required rejection smoke. - Valid ServerFill negotiation and echo operation. - Normal large-packet exchange. - Normal blocking/AsyncClient authenticated lifecycle and no-test equivalence. - Normal CLI single-target table/labeled output and healthy multi-target CSV output. ## Retained fake coverage - Malformed or bad-HMAC open and echo replies. - Missing/wrong authentication request observation. - Silent peers, retries, timeouts, loss, and late replies. - Exact timestamps, packet sizes, flags, tokens, sequences, and request construction. - Duplicate, reordered, unsolicited, wrong-token, and classification cases. - Peer-close synchronization, gated reply release, interruption races, queued-row draining, and deliberate open failures. ## Dependency boundary - `irtt-server` and the Tokio runtime used by fixtures are test/dev-only dependencies where added. - The no-default `irtt-client` normal dependency tree remains Tokio-free and `irtt-server`-free. - The client-only CLI production tree does not gain `irtt-server`. ## Cleanup - Removed the hand-written fake as the default backend and removed obsolete normal echo helper paths from AsyncClient and CLI tests. - Retained the shared integration support dead-code allowance because separate integration targets intentionally consume different subsets, including the explicitly selected external backend. - Added two small 74-line production-server lifecycle owners. The overall test-code diff is +153 lines, while removing approximately three compliant fake helper paths and the fake default backend branch; the maintenance gain is deletion of duplicated normal protocol semantics rather than a target LOC reduction. ## Scope - No production protocol, client, CLI, or server behavior changed. - No production test-only hooks were added. - No upstream source, tests, or history were inspected. - Ordinary CI has no automatic dependency on an external upstream executable. ## Verification - `cargo fmt --all -- --check` - `cargo check --workspace --all-targets --all-features --locked` - `cargo test --workspace --all-targets --all-features --locked` - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` - `RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features --no-deps` - `cargo test -p irtt-client --locked` - `cargo test -p irtt-client --all-features --locked` - `cargo check -p irtt-client --no-default-features --lib --locked` - `cargo clippy -p irtt-client --all-targets --all-features --locked -- -D warnings` - `cargo test -p irtt-cli --locked` - `cargo test -p irtt-cli --all-features --locked` - `cargo test -p irtt-cli --test client_multi_target --all-features --locked` - `cargo test -p irtt-cli --no-default-features --features client --locked` - `cargo check -p irtt-cli --no-default-features --all-targets --locked` - `cargo check -p irtt-cli --no-default-features --features client --all-targets --locked` - Normal dependency-tree audits for no-default `irtt-client` and client-only `irtt-cli`. - `git diff --check main...HEAD`
Sign in to join this conversation.