Skip to content

Commit 243b55b

Browse files
committed
add small timeout to producer/consumer fixture closes in test_producer
1 parent 5ef6595 commit 243b55b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/integration/test_producer_integration.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def producer_factory(**kwargs):
1616
try:
1717
yield producer
1818
finally:
19-
producer.close(timeout=0)
19+
producer.close(timeout=1)
2020

2121

2222
@contextmanager
@@ -25,7 +25,7 @@ def consumer_factory(**kwargs):
2525
try:
2626
yield consumer
2727
finally:
28-
consumer.close(timeout_ms=0)
28+
consumer.close(timeout_ms=100)
2929

3030

3131
@pytest.mark.skipif(not env_kafka_version(), reason="No KAFKA_VERSION set")
@@ -82,7 +82,7 @@ def test_end_to_end(kafka_broker, compression):
8282
def test_kafka_producer_gc_cleanup():
8383
gc.collect()
8484
threads = threading.active_count()
85-
producer = KafkaProducer(api_version='0.9') # set api_version explicitly to avoid auto-detection
85+
producer = KafkaProducer(api_version=(2, 1)) # set api_version explicitly to avoid auto-detection
8686
assert threading.active_count() == threads + 1
8787
del(producer)
8888
gc.collect()

0 commit comments

Comments
 (0)