schedwalk - an async executor testing all possible polling schedules
Hi! I just published schedwalk an async executor that exhaustively tests your futures under all possible polling schedules. It does so by walking the tree of all possible sequences in which futures can be polled in.
This makes it possible to deterministically test for certain race conditions where you accidentally assume things to happen in some specific order. Production executors like Tokio will generally in tests either:
- Deterministically execute a specific schedule when eg. using a single-threaded executor, in which case you are not testing the many other polling schedules possible.
- Non-deterministically execute a random schedule when eg, using a multi-threaded executor, in which case you risk creating flaky tests instead.
Whereas schedwalk will deterministically execute all schedules.
There are some important caveats though:
- It assumes determinism. There must be no external influence on which order futures can be polled in like threads, IO, thread-locals, etc.
- It exhaustively walks all possible schedules which can quickly become intractable if you have a lot of concurrent futures.
- Making your code executor-agnostic is close to impossible in Rust right now, so it might not be practical if you need to inject it into your non-test code.
Docs: https://docs.rs/schedwalk/0.1.0/schedwalk/