ЛР 4 — БПИ2303 — Костылев — на 5 #162

Closed
akostylev2303 wants to merge 79 commits from akostylev2303/lab4 AGit into master
Showing only changes of commit 61dcb6bf13 - Show all commits
+8 -3
View File
@@ -78,7 +78,8 @@ def reconcile(*flags, env=None):
if code not in (0, 1) or not out.strip():
raise SystemExit(f"reconciler failed ({code}):\n{err[-800:]}")
report = json.loads(out)
report.update(exit_code=code, wall_seconds=wall)
audit = [json.loads(line) for line in err.splitlines() if '"audit.' in line]
report.update(exit_code=code, wall_seconds=wall, audit=audit)
return report
@@ -192,11 +193,15 @@ def faults(c, check, pre):
)
first = reconcile("--apply", "--deep", *FLAGS)
save("apply-1.json", first)
discarded = sorted(e["attachment_id"] for e in first["audit"] if e["reason"] == "reconcile")
check(
"apply исправляет ровно найденное dry-run",
pick(first["fixed"], FIXABLE) == pick(dry["found"], FIXABLE) and not first["errors"],
"apply исправляет ровно найденное dry-run, удаление намерений — в журнале аудита",
pick(first["fixed"], FIXABLE) == pick(dry["found"], FIXABLE)
and not first["errors"]
and discarded == sorted(injected["pending_stale"]),
dry_run=pick(dry["found"], FIXABLE),
fixed=pick(first["fixed"], FIXABLE),
audit_discarded=len(discarded),
)
second = reconcile("--apply", "--deep", *FLAGS)
save("apply-2.json", second)