191 build - поправлены старые падения, проверены 3 матча и 6 агентов одновременных
This commit is contained in:
@@ -121,7 +121,7 @@ def test_mapping_recovers_when_only_unrelated_vmix_inputs_change(tmp_path: Path)
|
||||
{
|
||||
"key": "score-key",
|
||||
"number": "17",
|
||||
"title": "Score Renamed",
|
||||
"title": "Score",
|
||||
"type": "GT",
|
||||
"fields": [{"name": "Clock.Text", "type": "text", "index": "4"}],
|
||||
},
|
||||
@@ -152,6 +152,7 @@ def test_mapping_recovers_when_only_unrelated_vmix_inputs_change(tmp_path: Path)
|
||||
)
|
||||
session.add(profile)
|
||||
session.flush()
|
||||
source_id = profile.id
|
||||
session.add(VmixMappingField(
|
||||
profile_id=profile.id,
|
||||
graphic="score",
|
||||
@@ -176,7 +177,9 @@ def test_mapping_recovers_when_only_unrelated_vmix_inputs_change(tmp_path: Path)
|
||||
assigned = [item for item in ws.sent if item.get("type") == "mapping.assigned"]
|
||||
missing = [item for item in ws.sent if item.get("type") == "mapping.missing"]
|
||||
assert assigned
|
||||
assert assigned[-1]["name"] == "RECOVER-MAP"
|
||||
assert assigned[-1]["id"] != source_id
|
||||
assert assigned[-1]["name"].startswith("__AUTO_MAPPING__")
|
||||
assert assigned[-1]["fields"][0]["vmix_input_title"] == "Score"
|
||||
assert not missing
|
||||
|
||||
with database.session() as session:
|
||||
@@ -184,9 +187,35 @@ def test_mapping_recovers_when_only_unrelated_vmix_inputs_change(tmp_path: Path)
|
||||
assert device is not None
|
||||
resolved = hub._active_mapping_profile_for_device(session, device)
|
||||
assert resolved is not None
|
||||
assert resolved.name == "RECOVER-MAP"
|
||||
# Compatibility recovery must not rewrite the profile's primary
|
||||
# fingerprint just because this Agent has an unrelated extra Input.
|
||||
assert resolved.project_fingerprint == old_stable
|
||||
assert resolved.id == device.mapping_profile_id == assigned[-1]["id"]
|
||||
assert device.mapping_source_profile_id == source_id
|
||||
assert device.mapping_profile_version == resolved.version == 1
|
||||
assert resolved.project_fingerprint == new_stable
|
||||
# Recovery publishes this Agent's independent snapshot without
|
||||
# rewriting the shared source template used by another project.
|
||||
source = session.get(VmixMappingProfile, source_id)
|
||||
assert source.name == "RECOVER-MAP" and source.project_fingerprint == old_stable
|
||||
assert source.active is True
|
||||
|
||||
asyncio.run(scenario())
|
||||
|
||||
|
||||
def test_mapping_recovery_does_not_guess_renamed_mapped_input_by_guid(tmp_path: Path):
|
||||
import json
|
||||
database = LocalTestDatabase(tmp_path / "renamed-target.sqlite3")
|
||||
database.create_all()
|
||||
hub = VmixAgentHub(database)
|
||||
with database.session() as session:
|
||||
profile = VmixMappingProfile(name="Existing mapping", project_fingerprint="a" * 64,
|
||||
inventory_json="{}", active=True, created_by="admin", updated_by="admin")
|
||||
session.add(profile)
|
||||
session.flush()
|
||||
session.add(VmixMappingField(profile_id=profile.id, data_key="game.clock", graphic="clock",
|
||||
vmix_input_key="same-guid", vmix_input_number="5", vmix_input_title="Score",
|
||||
vmix_field="Clock.Text", field_type="text", enabled=True, sort_order=0))
|
||||
device = VmixDevice(device_uuid="GFX-RENAMED", device_secret_hash="x", project_fingerprint="b" * 64,
|
||||
project_inventory_json=json.dumps({"inputs": [{"key": "same-guid", "number": "5",
|
||||
"title": "Score Renamed", "fields": [{"name": "Clock.Text", "type": "text"}]}]}))
|
||||
session.add(device)
|
||||
session.flush()
|
||||
assert hub._compatible_mapping_profile_for_device(session, device) is None
|
||||
|
||||
Reference in New Issue
Block a user