@@ -74,6 +74,20 @@ async def test_commit_offset_works(self, driver, topic_with_messages, topic_cons
74
74
topic_with_messages , topic_consumer , message .partition_id , message .offset + 1
75
75
)
76
76
77
+ async def test_commit_offset_with_session_id_works (self , driver , topic_with_messages , topic_consumer ):
78
+ async with driver .topic_client .reader (topic_with_messages , topic_consumer ) as reader :
79
+ for out in ["123" , "456" , "789" , "0" ]:
80
+ message = await reader .receive_message ()
81
+ assert message .data .decode () == out
82
+
83
+ await driver .topic_client .commit_offset (
84
+ topic_with_messages ,
85
+ topic_consumer ,
86
+ message .partition_id ,
87
+ message .offset + 1 ,
88
+ reader .read_session_id ,
89
+ )
90
+
77
91
async def test_reader_reconnect_after_commit_offset (self , driver , topic_with_messages , topic_consumer ):
78
92
async with driver .topic_client .reader (topic_with_messages , topic_consumer ) as reader :
79
93
for out in ["123" , "456" , "789" , "0" ]:
@@ -213,6 +227,20 @@ def test_commit_offset_works(self, driver_sync, topic_with_messages, topic_consu
213
227
topic_with_messages , topic_consumer , message .partition_id , message .offset + 1
214
228
)
215
229
230
+ def test_commit_offset_with_session_id_works (self , driver_sync , topic_with_messages , topic_consumer ):
231
+ with driver_sync .topic_client .reader (topic_with_messages , topic_consumer ) as reader :
232
+ for out in ["123" , "456" , "789" , "0" ]:
233
+ message = reader .receive_message ()
234
+ assert message .data .decode () == out
235
+
236
+ driver_sync .topic_client .commit_offset (
237
+ topic_with_messages ,
238
+ topic_consumer ,
239
+ message .partition_id ,
240
+ message .offset + 1 ,
241
+ reader .read_session_id ,
242
+ )
243
+
216
244
def test_reader_reconnect_after_commit_offset (self , driver_sync , topic_with_messages , topic_consumer ):
217
245
with driver_sync .topic_client .reader (topic_with_messages , topic_consumer ) as reader :
218
246
for out in ["123" , "456" , "789" , "0" ]:
0 commit comments