Skip to content

Commit 4f88810

Browse files
authored
tests: fix flakiness in connection cleanup test (#487)
1 parent ee1d7b0 commit 4f88810

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/system.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,11 @@ def test_subscriber_not_leaking_open_sockets(
446446
assert len(response.received_messages) == 3
447447

448448
conn_count_end = len(current_process.connections())
449-
assert conn_count_end == conn_count_start
449+
450+
# To avoid flakiness, use <= in the assertion, since on rare occasions additional
451+
# sockets are closed, causing the == assertion to fail.
452+
# https://github.com/googleapis/python-pubsub/issues/483#issuecomment-910122086
453+
assert conn_count_end <= conn_count_start
450454

451455

452456
def test_synchronous_pull_no_deadline_error_if_no_messages(

0 commit comments

Comments
 (0)