@@ -211,12 +211,15 @@ def test_consumer_should_completely_unsubscribe_from_topics():
211
211
"value" : "test34"
212
212
}
213
213
214
- write_into_kafka ("test_unsubscribe" , (message1 , message2 ))
214
+ t = f"test_unsubscribe_{ randomword (4 )} "
215
+ write_into_kafka (t , (message1 , message2 ))
215
216
216
217
server = get_server ()
217
218
218
- with create_consumer (server , KAFKA_HOST , {"group.id" : "should_completely_unsubscribe_from_topics" }):
219
- server .call ("consumer.subscribe" , [["test_unsubscribe" ]])
219
+ with create_consumer (server , KAFKA_HOST , {
220
+ "group.id" : "should_completely_unsubscribe_from_topics" ,
221
+ }):
222
+ server .call ("consumer.subscribe" , [[t ]])
220
223
221
224
response = server .call ("consumer.consume" , [10 ])[0 ]
222
225
@@ -225,9 +228,9 @@ def test_consumer_should_completely_unsubscribe_from_topics():
225
228
"test2" ,
226
229
}
227
230
228
- server .call ("consumer.unsubscribe" , [["test_unsubscribe" ]])
231
+ server .call ("consumer.unsubscribe" , [[t ]])
229
232
230
- write_into_kafka ("test_unsubscribe" , (message3 , ))
233
+ write_into_kafka (t , (message3 , ))
231
234
232
235
response = server .call ("consumer.consume" , [10 ])
233
236
@@ -257,11 +260,16 @@ def test_consumer_should_partially_unsubscribe_from_topics():
257
260
258
261
server = get_server ()
259
262
260
- with create_consumer (server , KAFKA_HOST , {"group.id" : "should_partially_unsubscribe_from_topics" }):
261
- server .call ("consumer.subscribe" , [["test_unsub_partially_1" , "test_unsub_partially_2" ]])
263
+ salt = randomword (4 )
264
+ with create_consumer (server , KAFKA_HOST , {
265
+ "group.id" : f"should_partially_unsubscribe_from_topics_{ salt } " ,
266
+ }):
267
+ t1 = f"test_unsub_partially_{ salt } _1"
268
+ t2 = f"test_unsub_partially_{ salt } _2"
269
+ server .call ("consumer.subscribe" , [[t1 , t2 ]])
262
270
263
- write_into_kafka ("test_unsub_partially_1" , (message1 , ))
264
- write_into_kafka ("test_unsub_partially_2" , (message2 , ))
271
+ write_into_kafka (t1 , (message1 , ))
272
+ write_into_kafka (t2 , (message2 , ))
265
273
time .sleep (5 )
266
274
267
275
# waiting up to 30 seconds
@@ -272,10 +280,10 @@ def test_consumer_should_partially_unsubscribe_from_topics():
272
280
"test2" ,
273
281
}
274
282
275
- server .call ("consumer.unsubscribe" , [["test_unsub_partially_1" ]])
283
+ server .call ("consumer.unsubscribe" , [[t1 ]])
276
284
277
- write_into_kafka ("test_unsub_partially_1" , (message3 , ))
278
- write_into_kafka ("test_unsub_partially_2" , (message4 , ))
285
+ write_into_kafka (t1 , (message3 , ))
286
+ write_into_kafka (t2 , (message4 , ))
279
287
time .sleep (5 )
280
288
281
289
response = server .call ("consumer.consume" , [30 ])[0 ]
0 commit comments