GRI-1856: real-TCP integration harness for server HTTP tests #92
No reviewers
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage!92
Loading…
Reference in a new issue
No description provided.
Delete branch "test/GRI-1856-server-integration-harness"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a real-TCP integration test harness for the server's HTTP surface, as the base every later route's integration test reuses. The existing
#[cfg(test)]unit tests incrates/server/src/http.rsusetower::ServiceExt::oneshot, which never opens a socket and never drivesaxum::serve. These tests do: a realTcpListener, the realserver::http::router(), and the sameaxum::serve(...).with_graceful_shutdown(...)wiringmain.rsuses.crates/server/tests/support/mod.rs—TestServer(spawn/trigger-shutdown/shut-down), a minimal raw HTTP/1.1 client overTcpStream, andgated_health_server(), which wraps the real router in test-only middleware that signals when a request has started being handled and waits to be released — so a shutdown test needs no sleep, only aNotify.crates/server/tests/http_integration.rs:health_check_over_real_tcp_returns_okgraceful_shutdown_finishes_an_in_flight_requestunknown_route_after_shutdown_signal_on_open_connection_is_not_found(unhappy-path pairing)Only non-test change:
tokiodev-dependency featuressyncandio-utiladded tocrates/server/Cargo.toml(needed foroneshot/NotifyandAsyncRead/WriteExt; production code needs neither).Fail-first check: temporarily removed the
/healthroute fromrouter()and reran — 2 of 3 tests failed (left: 404, right: 200). Reverted; all 3 pass.Test plan
cargo test -p server --test http_integration— 3/3 pass./scripts/local-gates.sh— full suite green