Skip to content

Attempt to fix flaky resume connection test #667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions test/test_mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,15 @@ def on_connection_success_callback_dup(connection, callback_data: OnConnectionSu
client_id=connection.client_id,
on_connection_success_callback=on_connection_success_callback_dup)

connection_dup.connect().result(TIMEOUT)
on_connection_success_future_dup.result(TIMEOUT)
connection_dup.disconnect().result(TIMEOUT)
dup_success = False
while not dup_success:
try:
connection_dup.connect().result(TIMEOUT)
on_connection_success_future_dup.result(TIMEOUT)
dup_success = True
connection_dup.disconnect().result(TIMEOUT)
except BaseException:
time.sleep(2)

# After the second client disconnects, the first one should reconnect,
# and on_connection_success callback should be fired once again.
Expand Down