190 build попытка 2

This commit is contained in:
2026-10-21 13:29:36 +03:00
parent bb4b6ad68d
commit 787f880c0e
23 changed files with 3 additions and 1553 deletions

View File

@@ -1,8 +1,4 @@
<<<<<<< HEAD
"""Exercise actual acknowledged Mapping delivery with protocol-shaped replies."""
=======
"""Exercise the BUILD113 transport that replaced the failing BUILD97 mocks."""
>>>>>>> e4bedb1264fca8a6bc8a41f0ca1ff67b176c6651
import asyncio
from datetime import datetime
@@ -22,7 +18,6 @@ def transport(tmp_path, fail_at=None):
s.add(VmixAssignment(device_id=device.id, assignment_key="assignment", wfl_user_id="owner",
game_external_id="g", active=True))
class Socket:
<<<<<<< HEAD
def __init__(self, device_id):
self.device_id = device_id
self.frames = []
@@ -37,15 +32,10 @@ def transport(tmp_path, fail_at=None):
"ok": True, "reason": "",
})
=======
def __init__(self):
self.frames = []
>>>>>>> e4bedb1264fca8a6bc8a41f0ca1ff67b176c6651
async def send_json(self, message):
if fail_at is not None and len(self.frames) == fail_at:
raise ConnectionError("fake disconnected socket")
self.frames.append(message)
<<<<<<< HEAD
if message.get("type") == "vmix.command":
self.max_pending = max(self.max_pending, sum(
pending[0] == self.device_id for pending in hub._pending_commands.values()))
@@ -53,9 +43,6 @@ def transport(tmp_path, fail_at=None):
if self.auto_ack:
await self.acknowledge(message)
own, other = Socket("GFX-OWNER"), Socket("GFX-VIEWER")
=======
own, other = Socket(), Socket()
>>>>>>> e4bedb1264fca8a6bc8a41f0ca1ff67b176c6651
hub = VmixAgentHub(db)
hub._live["GFX-OWNER"] = LiveAgent(own, datetime.utcnow())
hub._live["GFX-VIEWER"] = LiveAgent(other, datetime.utcnow())
@@ -72,22 +59,14 @@ def send(hub, rows):
match_id="g", entries=rows, use_batch=True))
<<<<<<< HEAD
def test_372_mapping_fields_are_acknowledged_ordered_and_isolated(tmp_path):
=======
def test_372_mapping_fields_are_ordered_and_isolated_without_ack(tmp_path):
>>>>>>> e4bedb1264fca8a6bc8a41f0ca1ff67b176c6651
hub, own, other = transport(tmp_path)
rows = entries(372)
result = send(hub, rows)
assert result["commands_sent"] == 372 and result["input_groups"] == 12
assert all(item["ok"] for item in result["results"])
<<<<<<< HEAD
assert result["ack_waited"] is True and result["transport"] == "sequential_ack"
assert own.max_pending == 1 and result["retries"] == 0
=======
assert result["ack_waited"] is False and result["transport"] == "sequential_no_ack"
>>>>>>> e4bedb1264fca8a6bc8a41f0ca1ff67b176c6651
assert own.frames[0]["type"] == "match.assign"
assert [f["command"] for f in own.frames[1:]] == [r["command"] for r in rows]
assert all(f["type"] == "vmix.command" and f["match_id"] == "g" and f["assignment_id"] == "assignment"
@@ -101,7 +80,6 @@ def test_disconnect_stops_remaining_mapping_and_reports_failure(tmp_path):
result = send(hub, entries(35))
assert result["commands_sent"] == 3
assert [row["ok"] for row in result["results"]] == [True] * 3 + [False] * 32
<<<<<<< HEAD
assert 0 <= result["retries"] <= 3
assert len(own.frames) == 4 and other.frames == []
@@ -131,9 +109,6 @@ def test_another_agent_completes_while_first_agent_ack_is_pending(tmp_path):
assert own.frames[-1]["match_id"] == "g"
asyncio.run(scenario())
=======
assert result["retries"] == 0 and len(own.frames) == 4 and other.frames == []
>>>>>>> e4bedb1264fca8a6bc8a41f0ca1ff67b176c6651
def test_unconfirmed_assignment_does_not_send_mapping(tmp_path):