test(hopper): synchronize silent reconnect expiry assertions (#12374)

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
This commit is contained in:
ShuaixinHuangandShuaixinHuang authored and GitHub committed 2026-11-19 14:37:18 +00:00
1 parent 7eac002d5e
commit 3fdda4e1a1
1 file changed
+8 -5
+8 -5
View File
@@ -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)