feat(tester): support isolated full regression workflow
This commit is contained in:
@@ -390,6 +390,27 @@ def write_run(root: Path, record: dict[str, Any]) -> Path:
|
||||
return path
|
||||
|
||||
|
||||
def all_active_result_rows(root: Path, *, blocked_by: str) -> list[dict[str, Any]]:
|
||||
"""Keep a testcase row for every active catalog entry when preflight blocks."""
|
||||
try:
|
||||
from generate_cases_csv import load_cases
|
||||
|
||||
cases = load_cases(root)
|
||||
except (ImportError, OSError, ValueError, SystemExit):
|
||||
cases = []
|
||||
rows: list[dict[str, Any]] = []
|
||||
for case in cases:
|
||||
if case.get("lifecycle", "active") != "active":
|
||||
continue
|
||||
rows.append({
|
||||
"id": str(case.get("id") or ""),
|
||||
"result": "not-run",
|
||||
"notes": "test-preflight 未通过,未创建移动 session",
|
||||
"blocked_by": [blocked_by],
|
||||
})
|
||||
return rows
|
||||
|
||||
|
||||
def run_test_preflight(
|
||||
config_path: Path,
|
||||
*,
|
||||
@@ -507,6 +528,7 @@ def execute(args: argparse.Namespace) -> int:
|
||||
record["platforms"][platform].update({"status": "not-run", "reason": "全量 preflight 闸门被另一平台阻断"})
|
||||
overall = record.get("preflight", {}).get("status") if "preflight" in record else "environment-fail"
|
||||
record.update({"status": overall if overall in {"blocked", "environment-fail"} else "environment-fail", "failure_class": "test-preflight" if "preflight" in record else "automatic-repair-failed", "next_action": "修复列出的平台环境后重跑;默认不会静默降级"})
|
||||
record["results"] = all_active_result_rows(context.root, blocked_by="test-preflight")
|
||||
else:
|
||||
for platform, (result, node, identity) in prepared.items():
|
||||
try:
|
||||
@@ -527,7 +549,18 @@ def execute(args: argparse.Namespace) -> int:
|
||||
record["evidence"] = context.evidence
|
||||
except (EnvironmentFailure, ArtifactFailure) as exc:
|
||||
record.update({"status": "environment-fail", "failure_class": "automatic-repair-failed", "error": str(exc), "evidence": context.evidence})
|
||||
if record.get("status") != "ready" and "results" not in record:
|
||||
record["results"] = all_active_result_rows(context.root, blocked_by="test-preflight")
|
||||
path = write_run(context.root, record)
|
||||
try:
|
||||
from generate_run_csv import export_run_csv
|
||||
|
||||
record["csv"] = str(export_run_csv(context.root, run_path=path))
|
||||
except (OSError, SystemExit, ValueError):
|
||||
# The YAML run remains the source of truth when a partial/provisioning
|
||||
# root has no catalog cases yet.
|
||||
record["csv"] = ""
|
||||
path.write_text(json.dumps(record, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
||||
output = {"status": record["status"], "run": str(path), "platforms": record["platforms"], "worktree": record.get("worktree")}
|
||||
if record.get("error"):
|
||||
output["error"] = record["error"]
|
||||
|
||||
Reference in New Issue
Block a user