tokio-rs / turmoil

Add hardship to your tests
MIT License
790 stars 50 forks source link

Make `Config.duration` as `Option<Duration>` #175

Closed quettabit closed 4 months ago

quettabit commented 4 months ago

i think this could be handy for users who'd like to have a custom loop containing sim.step() and other fault calls. for such custom loops, i think running for a fixed number of steps would be the only way to go. currently, for such cases, they should also be figuring out and configuring the simulation duration appropriately to go well with their simulation, so they don't face the "Ran for duration: {:?} steps: {} without completing" error. this change will enable them to just pass None for it.

pls let me know if this kind of change is acceptable.

mcches commented 4 months ago

Thanks for cutting a PR. Given this is a breaking API change I think we should consider alternatives. Passing Duration::MAX is about as much lift as passing None, and given that using step() manually is more of a super user feature this seems like an OK workaround. wdyt?

quettabit commented 4 months ago

cool. yeah makes sense. yeah, that workaround is fine.