Skip to content

Commit

Permalink
tests: fix partition real broker case
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancetnik committed May 9, 2024
1 parent aeb9115 commit 6c51dff
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tests/brokers/kafka/test_consume.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,24 @@ async def handler(msg: KafkaMessage):

@pytest.mark.asyncio()
async def test_manual_partition_consume(
self, queue: str, full_broker: KafkaBroker, event: asyncio.Event
self,
queue: str,
event: asyncio.Event,
):
consume_broker = self.get_broker()

tp1 = TopicPartition(queue, partition=0)

@full_broker.subscriber(partitions=[tp1])
async def handler_tp1(msg: KafkaMessage):
@consume_broker.subscriber(partitions=[tp1])
async def handler_tp1(msg):
event.set()

async with full_broker:
await full_broker.start()
async with self.patch_broker(consume_broker) as br:
await br.start()

await asyncio.wait(
(
asyncio.create_task(
full_broker.publish("hello", queue, partition=0)
),
asyncio.create_task(br.publish("hello", queue, partition=0)),
asyncio.create_task(event.wait()),
),
timeout=10,
Expand Down

0 comments on commit 6c51dff

Please sign in to comment.