tor-dirmgr: bridge descriptor tests: Fix a v. low prob. race

Drain a number of events, not just one.  The stream might yield many
events, as explained in this new comment.

This fails every time with MockExecutor::try_test_with_various().

I think it might fail with the tokio exeuctor too, but evidently not
with high probability or we would have noticed.
This commit is contained in:
Ian Jackson 2023-07-05 16:40:22 +01:00
parent bc63fdb34c
commit 473fd23f8b
1 changed files with 5 additions and 2 deletions

View File

@ -362,8 +362,11 @@ async fn success() -> Result<(), anyhow::Error> {
drop(hold);
// should produce a removed bridge event
let () = stream_drain_until(1, &mut events, || async {
// Check that queues become empty.
// Depending on scheduling, there may be tasks still live from the work above.
// For example, one of the requeues might be still running after we did the remove.
// So we may get a number of change events. Certainly not more than 10.
let () = stream_drain_until(10, &mut events, || async {
bdm.check_consistency(Some(&bridges));
queues_are_empty(&bdm)
})