Skip to content

Commit d7e3a60

Browse files
committed
Also sleep when waiting for consumers in test_describe_consumer_group_exists
1 parent d525925 commit d7e3a60

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/test_admin_integration.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def consumer_thread(i, group_id):
168168
stop[i] = Event()
169169
consumers[i] = kafka_consumer_factory(group_id=group_id)
170170
while not stop[i].is_set():
171-
consumers[i].poll(20)
171+
consumers[i].poll(timeout_ms=200)
172172
consumers[i].close()
173173
consumers[i] = None
174174
stop[i] = None
@@ -183,6 +183,7 @@ def consumer_thread(i, group_id):
183183
try:
184184
timeout = time() + 35
185185
while True:
186+
info('Checking consumers...')
186187
for c in range(num_consumers):
187188

188189
# Verify all consumers have been created
@@ -212,9 +213,9 @@ def consumer_thread(i, group_id):
212213

213214
if not rejoining and is_same_generation:
214215
break
215-
else:
216-
sleep(1)
217216
assert time() < timeout, "timeout waiting for assignments"
217+
info('sleeping...')
218+
sleep(1)
218219

219220
info('Group stabilized; verifying assignment')
220221
output = kafka_admin_client.describe_consumer_groups(group_id_list)
@@ -236,6 +237,8 @@ def consumer_thread(i, group_id):
236237
for c in range(num_consumers):
237238
info('Stopping consumer %s', c)
238239
stop[c].set()
240+
for c in range(num_consumers):
241+
info('Waiting for consumer thread %s', c)
239242
threads[c].join()
240243
threads[c] = None
241244

0 commit comments

Comments
 (0)