MockSleepRuntime::wait_for doesn't work very well.
For testing, we have the capacity to replace the regular timer implementation from our asynchronous runtime with a fake one that doesn't ever have to actually wait. That's MockSleepProvider
and MockSleepRuntime
in the tor-rtmock
crate.
We also provide another function that tries to run a future to completion, while advancing "mock time" step by step until it is ready. That's MockSleepRuntime::wait_for
in tor-rtmock/src/sleep_runtime.rs
. But unfortunately, it doesn't work too well, and I'm not sure why. I had it advancing one millisecond at a time, but the tests would fail under some circumstances when I did that (specifically, the circmgr tests under test coverage). I had to decrease the increment to 10 microseconds to make it work, which suggests to me that there is some fundamental problem in this code with making sure that all our futures get polled when they ought to get polled.
I'm marking this as First Contribution , but it is probably not a good fit for anybody without a deep understanding of Rust async implementations and their internals. On the other hand, if you know that stuff very well, you probably don't need to know Arti at all to solve this ticket.