Skip to main content

shared_runtime_test

Attribute Macro shared_runtime_test 

Source
#[shared_runtime_test]
Expand description

Runs an async test body on ONE runtime shared by the whole test binary, obtained from crate::common::runtime() (as local_db_sqlx_test expects setup()).

#[tokio::test] builds a runtime per test and drops it when the test ends. server::db’s production pool is a process-wide OnceCell, so connections opened inside the first test’s runtime are still pooled after that runtime is gone, and a later acquire fails with “A Tokio 1.x context was found, but it is being shutdown” — inside whatever test happened to run next, which is why it reads as a bug in unrelated code.