This commit is contained in:
Dhevenddra K G
2026-08-29 17:04:25 -07:00
committed by GitHub
2 changed files with 22 additions and 3 deletions
+7
View File
@@ -215,6 +215,13 @@ def _slack_frame():
async def test_one_hub_fans_out_to_both_adapters(monkeypatch):
"""THE step-3 invariant: slack + github share one relay socket; frames land
on their own adapter by provider tag."""
# Stub name resolution at its chokepoint. A dead port only refuses instantly on
# POSIX; on Windows it takes ~2.0s per call and this frame makes two, blowing the
# 2.0s wait_dispatched budget below. The env var stays as a no-network backstop.
async def _no_slack_api(self, team_id, method, params):
return None
monkeypatch.setattr(SlackRelayAdapter, "_slack_get", _no_slack_api)
monkeypatch.setenv("SLACK_API_URL", "http://127.0.0.1:9/")
hub = RelayHub(
"wss://relay.test/ws",
+15 -3
View File
@@ -20,9 +20,21 @@ from coworker.secrets import SecretStore
@pytest.fixture(autouse=True)
def _no_slack_network(monkeypatch):
"""Name/channel resolution is best-effort; unstubbed lookups must fail
instantly at a dead loopback port, never reach slack.com — a slow real
answer was blowing the 2s wait_dispatched window intermittently."""
"""Name/channel resolution is best-effort, so stub it at its single chokepoint.
A dead loopback port alone is not enough. Refusing a connection is only instant
on POSIX; on Windows it takes ~2.0s, and `_dispatch_slack_event` awaits both
`_display_name` and `_channel_name`, so one frame cost ~4s against the 2.0s
budget and no frame ever dispatched in time. `SLACK_API_URL` still points at a
dead port as a backstop, so an unstubbed path can never reach slack.com.
"""
async def _no_slack_api(self, team_id, method, params):
return None
monkeypatch.setattr(
relay_client.SlackRelayAdapter, "_slack_get", _no_slack_api
)
monkeypatch.setenv("SLACK_API_URL", "http://127.0.0.1:9/")