Run part of an integration test serially, but the rest parallel

⚓ Rust    📅 2025-10-01    👤 surdeus    👁️ 8      

surdeus

I have multiple integration tests. If I run each one individually, everything works fine. If I run all simultaneously, I sometimes get errors due to each individual test taking longer (so that an integration test can end up producing more output data than expected, and thus fail assertions). A solution I'm currently using is to put #[serial] attribute on that integration test. But then it will take longer to run through all the integration tests.

tokio crate has a function called block_in_place() that lets you run a chosen sequence of lines single-threaded while letting you run everything else multi-threaded.

I'm looking for something that works similar to block_in_place() but applies the same effect as#[serial] for the chosen block of code, while letting everything else in that integration test run in parallel to the other integration tests. How to achieve this?

2 posts - 2 participants

Read full topic

🏷️ Rust_feed