aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/test_search_connect_deadline.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-17 19:08:52 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-17 19:08:52 +0200
commit84946b1fef64ee619f1c161d57ef4afdc533eae2 (patch)
tree55d13c6536b5cc2bdb8754eb0d82b6339f01072b /packages/meshbay-hub/tests/test_search_connect_deadline.py
parent7e01b7e8c2ce2ef9fce8b6c053c3b7210b64f9bf (diff)
downloadmeshbay-84946b1fef64ee619f1c161d57ef4afdc533eae2.tar.gz
fix(spa): search hears a refused local network from the connection
On a Pixel, Chrome still lists the refused address when search gives up, so nothing tells it from a silent node. The connection given up on now runs to its own verdict and the refusal is reported then. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/tests/test_search_connect_deadline.py')
-rw-r--r--packages/meshbay-hub/tests/test_search_connect_deadline.py32
1 files changed, 19 insertions, 13 deletions
diff --git a/packages/meshbay-hub/tests/test_search_connect_deadline.py b/packages/meshbay-hub/tests/test_search_connect_deadline.py
index 0dfee4e0..50b52369 100644
--- a/packages/meshbay-hub/tests/test_search_connect_deadline.py
+++ b/packages/meshbay-hub/tests/test_search_connect_deadline.py
@@ -125,19 +125,25 @@ def test_a_fast_connection_is_unaffected():
assert out["at"] == 3000
-def test_a_node_refused_the_local_network_is_named_when_search_gives_up():
- """Android 17 and Chrome 155 refuse the node's address on the phone's Wi-Fi
- without the permission, and connect() names it only when ICE gives up,
- long after search has: the refusal is read from the connection then."""
+def test_a_node_refused_the_local_network_is_named_when_its_connection_says_so():
+ """Measured on a Pixel: when search gives up, ten seconds in, Chrome still
+ lists the refused address and counts its checks as sent, so nothing tells it
+ from a node that does not answer. The connection is left to reach its own
+ verdict, thirty seconds in, and the refusal is heard then."""
out = _attempt(lanRefused=[0])
- assert out["result"] == "failed" and out["reason"] == "local_network_blocked", out
- assert out["at"] == STALL_MS, out
+ assert out["result"] == "failed" and out["at"] == STALL_MS, out
+ assert out["lateRefusals"] == [{"groupId": "g1", "at": 30000}], out
+ # Closed once its verdict is in, not when search moved on.
+ assert out["closedAt"] == [30000], out
-def test_a_refused_node_does_not_stop_the_walk():
- """Refused here is one node: another of the group may be elsewhere."""
- out = _attempt(nodes=2, lanRefused=[0], answering=[1], progressAt=[], resolveAt=500)
- assert out["result"] == "connected", out
- # And when no node answers, the refusal is what is said, not a timeout.
- out = _attempt(nodes=2, lanRefused=[0])
- assert out["reason"] == "local_network_blocked", out
+def test_a_refused_node_does_not_hold_up_the_walk():
+ """Refused here is one node: another of the group may be elsewhere, and is
+ tried as soon as search gives up on the first."""
+ out = _attempt(nodes=2, lanRefused=[0], answering=[1], resolveAt=500)
+ assert out["result"] == "connected" and out["at"] == STALL_MS + 500, out
+
+
+def test_a_node_that_does_not_answer_is_closed_without_a_word():
+ out = _attempt(resolveAt=None)
+ assert out["lateRefusals"] == [], out