Skip to content

Commit dad1054

Browse files
committed
Updated tests.
Signed-off-by: Pavel Kirilin <win10@list.ru>
1 parent 0880264 commit dad1054

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/test_broker.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async def test_success_broadcast(nats_urls: List[str], nats_subject: str) -> Non
2626
await broker.startup()
2727
tasks = []
2828
for _ in range(10):
29-
tasks.append(asyncio.create_task(read_message(broker)))
29+
tasks.append(asyncio.wait_for(asyncio.create_task(read_message(broker)), 1))
3030

3131
sent_message = BrokerMessage(
3232
task_id=uuid.uuid4().hex,
@@ -44,7 +44,9 @@ async def test_success_queued(nats_urls: List[str], nats_subject: str) -> None:
4444
"""Testing that queue works."""
4545
broker = NatsBroker(servers=nats_urls, subject=nats_subject, queue=uuid.uuid4().hex)
4646
await broker.startup()
47-
reading_task = asyncio.create_task(read_message(broker))
47+
reading_task = asyncio.create_task(
48+
asyncio.wait_for(read_message(broker), timeout=1),
49+
)
4850

4951
sent_message = BrokerMessage(
5052
task_id=uuid.uuid4().hex,

0 commit comments

Comments
 (0)