grandpa: speed up tests (#8439)

* grandpa: tests: add peers with authority role

* grandpa: tests: manually wake-up poll_fn future
This commit is contained in:
André Silva
2021-03-24 08:56:25 +00:00
committed by GitHub
parent d98a3c7942
commit ee8e7f1bcd
3 changed files with 49 additions and 23 deletions
@@ -987,7 +987,7 @@ mod tests {
threads_pool.spawn_ok(until_imported.into_future().map(|_| ()));
// assert that we will make sync requests
let assert = futures::future::poll_fn(|_| {
let assert = futures::future::poll_fn(|ctx| {
let block_sync_requests = block_sync_requester.requests.lock();
// we request blocks targeted by the precommits that aren't imported
@@ -997,6 +997,11 @@ mod tests {
return Poll::Ready(());
}
// NOTE: nothing in this function is future-aware (i.e nothing gets registered to wake
// up this future), we manually wake up this task to avoid having to wait until the
// timeout below triggers.
ctx.waker().wake_by_ref();
Poll::Pending
});