#[warm_test]Expand description
Wraps an async test function so it receives a freshly cloned, migrated
sqlx::PgPool cloned from a template that’s built once.
The test database is dropped after the function returns, whether it panics or succeeds.
The template is built once per unique migration set, and reused across every test and every run,
so tests run in milliseconds regardless of schema size.
ⓘ
#[warmpool::warm_test(migrations = "./migrations")]
async fn creates_a_post(pool: sqlx::PgPool) {
let row: (i64,) = sqlx::query_as("SELECT count(*) FROM posts")
.fetch_one(&pool)
.await
.unwrap();
assert_eq!(row.0, 0);
}Arguments (both optional):
migrations = "./path"defaults to./migrations.database_url_env = "ENV_VAR"defaults toDATABASE_URL.