Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

lxfind
Copy link
Contributor

@lxfind lxfind commented May 20, 2022

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.

@gdanezis
Copy link
Collaborator

gdanezis commented May 20, 2022

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.

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.

@lxfind
Copy link
Contributor Author

lxfind commented May 20, 2022

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.

@bmwill
Copy link
Contributor

bmwill commented May 20, 2022

Is https://docs.rs/tokio/latest/tokio/time/fn.advance.html properly used in the test to advance time?

@bmwill
Copy link
Contributor

bmwill commented May 20, 2022

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

@lxfind lxfind force-pushed the test-properly-fix-test-subscription branch from 7a10548 to 5ceaf3a Compare May 20, 2022 20:58
@lxfind
Copy link
Contributor Author

lxfind commented May 20, 2022

Thanks Brandon! That might be the issue here.

Replaced all sleep with either yield or advance depending on the need.

@lxfind
Copy link
Contributor Author

lxfind commented May 20, 2022

Looks like this is failing on Linux. I am out of depth.

@lxfind
Copy link
Contributor Author

lxfind commented May 20, 2022

The core of this issue is this:
On Mac, the transaction stream stops at 105, and end up with a batch there, and then start from 106 afterwards.
On Linux, the transaction stream doesn't stop at 105 but continue all the way to 109.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants