These standalone module tests run a `StandaloneEnv` in-process. That means [`CompiledModule::with_module_async`] and [`CompiledModule::with_module`] own the Tokio runtime, host controller, module host, scheduler, `RelationalDB`, JS worker threads, etc. Some modules schedule repeating reducers during `init`. If these helpers return without explicitly shutting the database down, scheduled reducer c
(env: &StandaloneEnv, db_identity: Identity, test_result: std::thread::Result<()>)
| 347 | /// asks the host controller to exit the module host, closes and waits for the scheduler, |
| 348 | /// and then shuts down the `RelationalDB`. |
| 349 | async fn finish_module_test(env: &StandaloneEnv, db_identity: Identity, test_result: std::thread::Result<()>) { |
| 350 | let cleanup_result = env.delete_database(&Identity::ZERO, &db_identity).await; |
| 351 | |
| 352 | // Cleanup should not hide the result of the test body. |
| 353 | // If the test already panicked, resume that panic after attempting shutdown. |
| 354 | // If the test passed, make cleanup failure a test failure. |
| 355 | match (test_result, cleanup_result) { |
| 356 | (Ok(()), Ok(())) => {} |
| 357 | (Ok(()), Err(err)) => panic!("failed to delete test database {db_identity}: {err:#}"), |
| 358 | (Err(panic), Ok(())) => std::panic::resume_unwind(panic), |
| 359 | (Err(panic), Err(err)) => { |
| 360 | log::error!("failed to delete test database {db_identity} after test panic: {err:#}"); |
| 361 | std::panic::resume_unwind(panic); |
| 362 | } |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | /// For testing, persist to disk by default, as many tests |
| 367 | /// exercise functionality like restarting the database. |
no test coverage detected
searching dependent graphs…