From 3fdda4e1a125126ce650fb20fd46a545e04af3f7 Mon Sep 17 00:00:00 2001 From: ShuaixinHuang <1836656514@qq.com> Date: Thu, 19 Nov 2026 22:37:18 +0800 Subject: [PATCH] test(hopper): synchronize silent reconnect expiry assertions (#12374) Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> --- tests/fixtures/hopperBridgeReconnectProbe.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/fixtures/hopperBridgeReconnectProbe.py b/tests/fixtures/hopperBridgeReconnectProbe.py index 230c7f74ab..3d2c1bc366 100644 --- a/tests/fixtures/hopperBridgeReconnectProbe.py +++ b/tests/fixtures/hopperBridgeReconnectProbe.py @@ -78,7 +78,7 @@ def probe(path, socket_path, mode): def finish(shutdown_count): worker.join(2) - assert not worker.is_alive(), "Bridge pinned its execution thread" + assert not worker.is_alive(), f"{mode}: bridge pinned its execution thread" assert not failures, failures assert not Path(socket_path).exists(), "Bridge retained its closed listener" assert requests.count("shutdown_document") == shutdown_count @@ -90,10 +90,13 @@ def probe(path, socket_path, mode): # bind() creates the socket path before listen() makes it connectable. client, file = connect(wait_until_listening=True) if mode == "silent-expiry": - result = finish(0) - file.close() - client.close() - return result + # connect() can finish while the peer is still in the listen backlog. + # Observe the bridge expiring the silent connection before waiting + # for its separate reconnect grace period to release the listener. + with client, file: + client.settimeout(5) + assert file.read(1) == b"", "Silent bridge connection did not close without a reply" + return finish(0) send(file, "health", "foreign-token" if mode == "unauthorized" else "owned-token") if mode == "lost-reply": assert entered.wait(2)