Migrate away from fake_time #8782
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead we'll have:
clockControl
which can be used to elapse time withintestWithProfile
clockControl
you can use:Future.timeoutWithClock
in place ofFuture.timeout
clock.delayed
in place ofFuture.delayed
This way, a timeout or delay that is used to handle an I/O operation that doesn't complete and use
Future.timeout
(orFuture.delayed
).While a delay or timeout that is used to schedule something after a certain delay can used
clock.delayed
(orFuture.timeoutWithClock
).One of these can be artificially accelerated with
clockControl
other can't.If you accelerate a 300ms timeout that throws an error if an I/O operation doesn't complete in 300ms, then it's hard to write a test where the I/O operation succeeds.
If you don't accelerate a delay where you're waiting an hour before rescheduling a task, then tests will take forever to run.
Hence, we have normal
timeout
/Future.delayed
, and we haveclock.delayed
andFuture.timeoutWithClock
, which are controlled withclockControl
.