Fix unmanaged reconciliation review blockers
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
co-authored by
genichin
parent
f9284d1de8
commit
591db7adb7
@@ -73,3 +73,44 @@ def test_daemon_wires_shared_alarm_emitter_into_intent_service():
|
||||
found = True
|
||||
break
|
||||
assert found, "Daemon must pass self.alarm_emitter into IntentService(alarm_emitter=...)"
|
||||
|
||||
|
||||
def test_daemon_wires_reconciliation_broker_into_snapshot_scheduler():
|
||||
src = (
|
||||
Path(__file__).resolve().parents[2]
|
||||
/ "trex_core"
|
||||
/ "runtime"
|
||||
/ "daemon.py"
|
||||
).read_text(encoding="utf-8")
|
||||
tree = ast.parse(src)
|
||||
found = False
|
||||
for node in ast.walk(tree):
|
||||
if not isinstance(node, ast.Assign):
|
||||
continue
|
||||
if not any(
|
||||
isinstance(t, ast.Attribute) and t.attr == "snapshot_scheduler"
|
||||
for t in node.targets
|
||||
):
|
||||
continue
|
||||
call = node.value
|
||||
if not (
|
||||
isinstance(call, ast.Call)
|
||||
and isinstance(call.func, ast.Name)
|
||||
and call.func.id == "SnapshotScheduler"
|
||||
):
|
||||
continue
|
||||
for kw in call.keywords:
|
||||
if kw.arg != "core_holdings_broker":
|
||||
continue
|
||||
if (
|
||||
isinstance(kw.value, ast.Attribute)
|
||||
and kw.value.attr == "reconciliation_broker"
|
||||
and isinstance(kw.value.value, ast.Name)
|
||||
and kw.value.value.id == "self"
|
||||
):
|
||||
found = True
|
||||
break
|
||||
assert found, (
|
||||
"Daemon must pass self.reconciliation_broker into "
|
||||
"SnapshotScheduler(core_holdings_broker=...)"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user