@@ -41,13 +41,10 @@ async def test_random_producer_id(self, driver: ydb.aio.Driver, topic_path, topi
41
41
async with driver .topic_client .writer (topic_path ) as writer :
42
42
await writer .write (ydb .TopicWriterMessage (data = "123" .encode ()))
43
43
44
- batch = await topic_reader .receive_batch ()
44
+ msg1 = await topic_reader .receive_message ()
45
+ msg2 = await topic_reader .receive_message ()
45
46
46
- if len (batch .messages ) == 1 :
47
- batch2 = await topic_reader .receive_batch ()
48
- batch .messages .extend (batch2 .messages )
49
-
50
- assert batch .messages [0 ].producer_id != batch .messages [1 ].producer_id
47
+ assert msg1 .producer_id != msg2 .producer_id
51
48
52
49
async def test_auto_flush_on_close (self , driver : ydb .aio .Driver , topic_path ):
53
50
async with driver .topic_client .writer (
@@ -80,18 +77,16 @@ async def test_write_multi_message_with_ack(
80
77
assert res1 .offset == 0
81
78
assert res2 .offset == 1
82
79
83
- batch = await topic_reader .receive_batch ()
80
+ msg1 = await topic_reader .receive_message ()
81
+ msg2 = await topic_reader .receive_message ()
84
82
85
- assert batch . messages [ 0 ] .offset == 0
86
- assert batch . messages [ 0 ] .seqno == 1
87
- assert batch . messages [ 0 ] .data == "123" .encode ()
83
+ assert msg1 .offset == 0
84
+ assert msg1 .seqno == 1
85
+ assert msg1 .data == "123" .encode ()
88
86
89
- # # remove second recieve batch when implement batching
90
- # # https://github.com/ydb-platform/ydb-python-sdk/issues/142
91
- # batch = await topic_reader.receive_batch()
92
- assert batch .messages [1 ].offset == 1
93
- assert batch .messages [1 ].seqno == 2
94
- assert batch .messages [1 ].data == "456" .encode ()
87
+ assert msg2 .offset == 1
88
+ assert msg2 .seqno == 2
89
+ assert msg2 .data == "456" .encode ()
95
90
96
91
@pytest .mark .parametrize (
97
92
"codec" ,
@@ -189,9 +184,10 @@ def test_random_producer_id(
189
184
with driver_sync .topic_client .writer (topic_path ) as writer :
190
185
writer .write (ydb .TopicWriterMessage (data = "123" .encode ()))
191
186
192
- batch = topic_reader_sync .receive_batch ()
187
+ msg1 = topic_reader_sync .receive_message ()
188
+ msg2 = topic_reader_sync .receive_message ()
193
189
194
- assert batch . messages [ 0 ]. producer_id != batch . messages [ 1 ] .producer_id
190
+ assert msg1 . producer_id != msg2 .producer_id
195
191
196
192
def test_write_multi_message_with_ack (
197
193
self , driver_sync : ydb .Driver , topic_path , topic_reader_sync : ydb .TopicReader
@@ -204,18 +200,16 @@ def test_write_multi_message_with_ack(
204
200
]
205
201
)
206
202
207
- batch = topic_reader_sync .receive_batch ()
208
- if len (batch .messages ) == 1 :
209
- batch2 = topic_reader_sync .receive_batch ()
210
- batch .messages .extend (batch2 .messages )
203
+ msg1 = topic_reader_sync .receive_message ()
204
+ msg2 = topic_reader_sync .receive_message ()
211
205
212
- assert batch . messages [ 0 ] .offset == 0
213
- assert batch . messages [ 0 ] .seqno == 1
214
- assert batch . messages [ 0 ] .data == "123" .encode ()
206
+ assert msg1 .offset == 0
207
+ assert msg1 .seqno == 1
208
+ assert msg1 .data == "123" .encode ()
215
209
216
- assert batch . messages [ 1 ] .offset == 1
217
- assert batch . messages [ 1 ] .seqno == 2
218
- assert batch . messages [ 1 ] .data == "456" .encode ()
210
+ assert msg2 .offset == 1
211
+ assert msg2 .seqno == 2
212
+ assert msg2 .data == "456" .encode ()
219
213
220
214
@pytest .mark .parametrize (
221
215
"codec" ,
0 commit comments