Add events in Pubsub

To ensure `handle_peer_queue` and `handle_dead_peer_queue` are indeed
run before the tests finish. Previously, we get errors when performing
`iter_dag` after cancellation. This is because `handle_peer_queue` or
`handle_dead_peer_queue` is not actually run before the Service is
cancelled.
This commit is contained in:
mhchia
2020-01-18 00:17:30 +08:00
parent 54871024cc
commit 6c7aa30191
4 changed files with 16 additions and 1 deletions

View File

@ -245,6 +245,8 @@ class PubsubFactory(factory.Factory):
strict_signing=strict_signing,
)
async with background_trio_service(pubsub):
await pubsub.event_handle_peer_queue_started.wait()
await pubsub.event_handle_dead_peer_queue_started.wait()
yield pubsub
@classmethod