You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 25, 2026. It is now read-only.
Would allow running integration tests with Shuttle resources, by using similar logic to cargo-shuttle's local provisioner
Suggestion or Example of how the feature would be used
Most of the rust code copied from axum testing example
# Cargo.toml
[dependencies]
shuttle-runtime = "0.x.0"
[dev-dependencies]
# feature gate the test macro since it will likely pull in more depsshuttle-runtime = { version = "0.x.0", features = ["test"] }
// lib.rs/// Having a function that produces our app makes it easy to call it from tests/// without having to create an HTTP server.fnapp(state:AppState) -> Router{Router::new().route("/",get(|| async{"Hello, World!"})).with_state(state)}
use axum::{
body::Body,
http::{Request,StatusCode},};use http_body_util::BodyExt;// for `collect`use tower::{Service,ServiceExt};// for `oneshot`#[shuttle_runtime::test]fntest(// can the underlying provisioner use `testcontainers` instead of the normal local provisioner's `bollard` calls?#[shuttle_shared_db::Postgres]pool:PgPool,){let state = ...;let app = app(state);// `Router` implements `tower::Service<Request<Body>>` so we can// call it like any tower service, no need to run an HTTP server.let response = app
.oneshot(Request::builder().uri("/").body(Body::empty()).unwrap()).await.unwrap();assert_eq!(response.status(),StatusCode::OK);let body = response.into_body().collect().await.unwrap().to_bytes();assert_eq!(&body[..],b"Hello, World!");}
One approach could be to bake the testing logic into the runtime somehow.
Or it could be done similarly to shuttle run as a shuttle test command that runs only the shuttle-annotated tests.
Duplicate declaration
I have searched the issues and this feature has not been requested before.
Describe the feature
Would allow running integration tests with Shuttle resources, by using similar logic to cargo-shuttle's local provisioner
Suggestion or Example of how the feature would be used
Most of the rust code copied from axum testing example
One approach could be to bake the testing logic into the runtime somehow.
Or it could be done similarly to
shuttle runas ashuttle testcommand that runs only the shuttle-annotated tests.Duplicate declaration