You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test harness: drop async mutating methods at each await point #2032
Several bugs have had the same shape. A method moves state out of self, or changes part of it, and then awaits. A caller that drops the future at that await leaves self torn: a timeout, a select!, an HTTP client that disconnects. #1261 and #1718 were fixed one at a time, and review of #2023 found two more in Transaction: rollback_to, and a stage that failed or was dropped.
A harness could catch the whole class instead:
For each public async method that takes &mut self, or changes shared state, poll it with a no-op waker.
Drop it after its 1st, 2nd, … Nth Pending.
Check the object's invariants.
Check that a follow-up call behaves as if the dropped call never ran, or ran in full.
The hard part is that many paths never return Pending in tests. Staging over novelty, or over a file-backed index, completes on its first poll, so a dropped call can't be reproduced there. The harness needs injected yield points, for example:
a storage wrapper that yields once per read, or
a test hook that yields at chosen awaits.
Until then, the #2023 tests make the same awaits fail, by exceeding a fuel limit, as a deterministic stand-in for a drop.
Activity