# Testing signals — tokio-rs/axum

> Canonical page: https://codevetter.com/unpack/axum/testing-signals

# Testing signals — tokio-rs/axum

Scanned commit f8b02f22cf10bee707bda19b58265b9e33677535 (2026-09-30). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Tests and CI were inspected, not executed; test existence is not evidence of a passing result. The inspected suite combines Tokio runtime tests, direct Tower service calls, real HTTP/WebSocket clients, and nightly compile-time fixtures. Assertions cover several important protocol and rejection behaviors, while individual example tests have narrower scopes. This is a bounded assessment without measured coverage or live integration verification.
- CI declares stable/beta locked all-feature, all-target tests for both workspaces, a separate nightly macro job, and Rust 1.80 tests after minimal-version dependency selection; these configurations were read, not run. — [.github/workflows/CI.yml#L83-L145](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/.github/workflows/CI.yml#L83-L145)
- The internal #[crate::test] helper expands to #[tokio::test] and generates an additional nest_service variant when a test contains matching nest calls; TestClient launches an ephemeral localhost server and uses reqwest with redirects disabled. — [axum-macros/src/axum_test.rs#L5-L43](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum-macros/src/axum_test.rs#L5-L43) [axum/src/test_helpers/test_client.rs#L11-L48](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/test_helpers/test_client.rs#L11-L48)
- Routing tests assert inherited versus overridden nested fallbacks; HEAD tests use Router::oneshot directly and assert preserved headers with an empty response body for handlers and services. — [axum/src/routing/tests/fallback.rs#L84-L109](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/routing/tests/fallback.rs#L84-L109) [axum/src/routing/tests/get_to_head.rs#L7-L34](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/routing/tests/get_to_head.rs#L7-L34) [axum/src/routing/tests/get_to_head.rs#L41-L68](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/routing/tests/get_to_head.rs#L41-L68)
- Json tests assert successful deserialization, 415 without JSON content type, accepted +json media types, 400 for syntax/trailing-data errors, and 422 with a field path for invalid typed data. — [axum/src/json.rs#L242-L308](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/json.rs#L242-L308) [axum/src/json.rs#L312-L332](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/json.rs#L312-L332) [axum/src/json.rs#L351-L367](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/json.rs#L351-L367)
- Server tests use paused Tokio time and duplex IO to assert stalled-header closure; graceful_shutdown_completes_inflight_request holds a handler open, signals shutdown, then checks that its response completes before the server resolves. — [axum/src/serve/mod.rs#L1229-L1283](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/serve/mod.rs#L1229-L1283) [axum/src/serve/mod.rs#L1333-L1400](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/serve/mod.rs#L1333-L1400)
- Macro UI tests use trybuild pass/fail fixtures only on nightly, become a no-op on other toolchains, and accept AXUM_TEST_ONLY; inspected failures exercise wrong extractor order and a non-Send future. — [axum-macros/src/lib.rs#L796-L827](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum-macros/src/lib.rs#L796-L827) [axum-macros/tests/debug_handler/fail/wrong_order.rs#L1-L10](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum-macros/tests/debug_handler/fail/wrong_order.rs#L1-L10) [axum-macros/tests/debug_handler/fail/not_send.rs#L1-L9](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum-macros/tests/debug_handler/fail/not_send.rs#L1-L9)
- The WebSocket example tests one text echo through a real tokio-tungstenite connection and through mocked Sink/Stream channels; the SSE example integration test takes one event and asserts its data is hi!. — [examples/testing-websockets/src/main.rs#L103-L146](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/examples/testing-websockets/src/main.rs#L103-L146) [examples/sse/src/main.rs#L99-L126](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/examples/sse/src/main.rs#L99-L126)
- Form tests check GET markup and one POST response; validator tests check missing, empty, short, and valid names; the inspected static-file test checks one root-path fallback returning index HTML with 404, rather than every service variant. — [examples/form/src/main.rs#L84-L123](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/examples/form/src/main.rs#L84-L123) [examples/validator/src/main.rs#L115-L166](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/examples/validator/src/main.rs#L115-L166) [examples/static-file-server/src/tests.rs#L8-L27](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/examples/static-file-server/src/tests.rs#L8-L27) [examples/static-file-server/src/main.rs#L30-L38](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/examples/static-file-server/src/main.rs#L30-L38)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
