Skip to content

Commit 6104623

Browse files
orange-kaowbarnha
andauthored
Improve test/test_consumer_integration.py in GitHub runner (dpkp#194)
test/test_consumer_integration.py::test_kafka_consumer__blocking failed in https://github.com/wbarnha/kafka-python-ng/actions/runs/10361086008/job/28680735389?pr=186 because it took 592ms to finish. Output from the GitHub runner attached This commit increase TIMEOUT_MS so it is less likely to fail on GitHub runner. # Ask for 5 messages, 10 in queue. Get 5 back, no blocking messages = [] with Timer() as t: for i in range(5): msg = next(consumer) messages.append(msg) assert_message_count(messages, 5) > assert t.interval < (TIMEOUT_MS / 1000.0) E assert 0.5929090976715088 < (500 / 1000.0) E + where 0.5929090976715088 = <test.testutil.Timer object at 0x7f6c4b50e960>.interval Co-authored-by: William Barnhart <[email protected]>
1 parent 9bee9fc commit 6104623

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/test_consumer_integration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def test_kafka_consumer_unsupported_encoding(
6161

6262
@pytest.mark.skipif(not env_kafka_version(), reason="No KAFKA_VERSION set")
6363
def test_kafka_consumer__blocking(kafka_consumer_factory, topic, send_messages):
64-
TIMEOUT_MS = 500
64+
TIMEOUT_MS = 1000
6565
consumer = kafka_consumer_factory(auto_offset_reset='earliest',
6666
enable_auto_commit=False,
6767
consumer_timeout_ms=TIMEOUT_MS)
@@ -70,7 +70,7 @@ def test_kafka_consumer__blocking(kafka_consumer_factory, topic, send_messages):
7070
consumer.unsubscribe()
7171
consumer.assign([TopicPartition(topic, 0)])
7272

73-
# Ask for 5 messages, nothing in queue, block 500ms
73+
# Ask for 5 messages, nothing in queue, block 1000ms
7474
with Timer() as t:
7575
with pytest.raises(StopIteration):
7676
msg = next(consumer)
@@ -87,7 +87,7 @@ def test_kafka_consumer__blocking(kafka_consumer_factory, topic, send_messages):
8787
assert_message_count(messages, 5)
8888
assert t.interval < (TIMEOUT_MS / 1000.0)
8989

90-
# Ask for 10 messages, get 5 back, block 500ms
90+
# Ask for 10 messages, get 5 back, block 1000ms
9191
messages = []
9292
with Timer() as t:
9393
with pytest.raises(StopIteration):

0 commit comments

Comments
 (0)