-
Notifications
You must be signed in to change notification settings - Fork 11.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly fix test_subscription test #2094
Conversation
The whole point of the time paused flag is to reliably test function where time is involved :) . It disconnects tokio::time::Instant and tokio::time::sleep from the real clock, and operates the event loop as a discrete event simulator. |
Oh didn't know that. But then in that case, there is no way to rely on batch behavior deterministically, right? Because you could be ticking all the time and hence batching at arbitrary times. |
Is https://docs.rs/tokio/latest/tokio/time/fn.advance.html properly used in the test to advance time? |
Probably would also need to make sure we used https://docs.rs/tokio/latest/tokio/time/struct.Instant.html instead of the stdlib type to make sure the mocked time in tests is properly handled |
7a10548
to
5ceaf3a
Compare
Thanks Brandon! That might be the issue here. Replaced all sleep with either yield or advance depending on the need. |
Looks like this is failing on Linux. I am out of depth. |
The core of this issue is this: |
The
start_paused
config means to start the test with time paused. The documentation isn't very clear about what happens if you depend on time in the test when time is paused, but my best guess is it's undefined?Removing this fixed all the mysterious time interval issues.