@@ -444,7 +444,7 @@ async def test_meta(self, iggy_client: IggyClient, consumer_group_setup):
444444 await iggy_client .create_topic (
445445 stream = stream_name , name = topic_name , partitions_count = 1
446446 )
447- consumer = iggy_client .consumer_group (
447+ consumer = await iggy_client .consumer_group (
448448 consumer_name ,
449449 stream_name ,
450450 topic_name ,
@@ -481,7 +481,7 @@ async def test_consume_messages(
481481 stream = stream_name , name = topic_name , partitions_count = 1
482482 )
483483
484- consumer = iggy_client .consumer_group (
484+ consumer = await iggy_client .consumer_group (
485485 consumer_name ,
486486 stream_name ,
487487 topic_name ,
@@ -509,6 +509,48 @@ async def send() -> None:
509509
510510 assert received_messages == test_messages
511511
512+ @pytest .mark .asyncio
513+ async def test_iter_messages (self , iggy_client : IggyClient , consumer_group_setup ):
514+ """Test that the consumer group can consume messages."""
515+ consumer_name = consumer_group_setup ["consumer" ]
516+ stream_name = consumer_group_setup ["stream" ]
517+ topic_name = consumer_group_setup ["topic" ]
518+ partition_id = consumer_group_setup ["partition_id" ]
519+ test_messages = consumer_group_setup ["messages" ]
520+
521+ # Setup
522+ received_messages = []
523+ shutdown_event = asyncio .Event ()
524+ await iggy_client .create_stream (stream_name )
525+ await iggy_client .create_topic (
526+ stream = stream_name , name = topic_name , partitions_count = 1
527+ )
528+
529+ consumer = await iggy_client .consumer_group (
530+ consumer_name ,
531+ stream_name ,
532+ topic_name ,
533+ partition_id ,
534+ PollingStrategy .Next (),
535+ 10 ,
536+ auto_commit = AutoCommit .Interval (timedelta (seconds = 5 )),
537+ poll_interval = timedelta (seconds = 1 ),
538+ )
539+
540+ await iggy_client .send_messages (
541+ stream_name ,
542+ topic_name ,
543+ partition_id ,
544+ [Message (m ) for m in test_messages ],
545+ )
546+
547+ async for message in consumer .iter ():
548+ received_messages .append (message .payload ().decode ())
549+ if len (received_messages ) == 5 :
550+ break
551+
552+ assert received_messages == test_messages
553+
512554 @pytest .mark .asyncio
513555 async def test_shutdown (self , iggy_client : IggyClient , consumer_group_setup ):
514556 """Test that the consumer group can be signaled to shutdown."""
@@ -524,7 +566,7 @@ async def test_shutdown(self, iggy_client: IggyClient, consumer_group_setup):
524566 stream = stream_name , name = topic_name , partitions_count = 1
525567 )
526568
527- consumer = iggy_client .consumer_group (
569+ consumer = await iggy_client .consumer_group (
528570 consumer_name ,
529571 stream_name ,
530572 topic_name ,
0 commit comments