Description
When tokio::time::pause
is called in a current-thread runtime, tokio will automatically skip time ahead to the next timer when all tasks are blocked. I want to use this to test whether some complex code does not issue a HTTP request over a long period, without making a test very slow and/or racy.
Unfortunately, httptest
in its current form spawns a separate tokio runtime on a background thread. This prevents a test current_thread runtime from accurately judging whether any progress is being made, leading to premature advancement of the simulated clock. Could run
be revised to, or grow an option to, spawn tasks in the caller's runtime instead?
See also https://docs.rs/tokio/latest/tokio/time/fn.pause.html#auto-advance, https://tokio.rs/tokio/topics/testing.