generated from coulomb/repo-seed
preflight gating
This commit is contained in:
@@ -344,6 +344,89 @@ class CoreArchitectureTests(unittest.TestCase):
|
||||
thread.join(timeout=5)
|
||||
server.server_close()
|
||||
|
||||
def test_preflight_failure_blocks_downstream_checks(self) -> None:
|
||||
with TemporaryDirectory() as temporary_directory:
|
||||
temp_root = Path(temporary_directory)
|
||||
target_path = temp_root / "target.json"
|
||||
assessment_path = temp_root / "assessment.json"
|
||||
target_path.write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"id": "local-cmis-preflight-failure",
|
||||
"subject_type": "cmis-browser-binding-endpoint",
|
||||
"subject_name": "Local CMIS Preflight Failure",
|
||||
"environment": "test",
|
||||
"scope": ["preflight", "tck-wrapper"],
|
||||
"endpoints": [
|
||||
{
|
||||
"id": "browser-binding",
|
||||
"url": "http://127.0.0.1:9/cmis/browser",
|
||||
"binding": "cmis-browser",
|
||||
}
|
||||
],
|
||||
"artifacts": [],
|
||||
"credentials_ref": None,
|
||||
"declared_capabilities": ["cmis.repository-info"],
|
||||
"known_gaps": [],
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
assessment_path.write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"id": "local-cmis-preflight-gate",
|
||||
"framework_refs": ["cmis.browser-binding.compatibility.v1"],
|
||||
"extension_refs": ["open-cmis-tck"],
|
||||
"target_profile_ref": "local-cmis-preflight-failure",
|
||||
"selected_check_groups": {
|
||||
"open-cmis-tck": ["repository-type"]
|
||||
},
|
||||
"expectations_ref": None,
|
||||
"waivers_ref": None,
|
||||
"output_policy": {
|
||||
"report_formats": ["json", "markdown"],
|
||||
"artifact_retention": "summary-only",
|
||||
},
|
||||
"retention_policy": {
|
||||
"summary_days": 365,
|
||||
"raw_artifact_days": 0,
|
||||
},
|
||||
"runtime_policy": {
|
||||
"offline": False,
|
||||
"timeout_seconds": 1,
|
||||
},
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
result = run_assessment(
|
||||
ROOT,
|
||||
target_path,
|
||||
assessment_path,
|
||||
temp_root / "run",
|
||||
)
|
||||
run_dir = Path(result["run_dir"])
|
||||
evidence = json.loads(
|
||||
(run_dir / "normalized" / "evidence.json").read_text(encoding="utf-8")
|
||||
)["evidence"]
|
||||
findings = json.loads(
|
||||
(run_dir / "normalized" / "findings.json").read_text(encoding="utf-8")
|
||||
)["findings"]
|
||||
|
||||
self.assertEqual(result["status"], "infrastructure_error")
|
||||
self.assertEqual(evidence[0]["result"], "infrastructure_error")
|
||||
self.assertEqual(evidence[1]["result"], "blocked")
|
||||
self.assertEqual(evidence[1]["facts"]["blocked_reason"], "preflight_failed")
|
||||
self.assertEqual(
|
||||
evidence[1]["facts"]["preflight_evidence_ref"],
|
||||
evidence[0]["id"],
|
||||
)
|
||||
self.assertFalse((run_dir / "artifacts" / "runner-contexts").exists())
|
||||
self.assertEqual(findings[1]["classification"], "preflight_failed")
|
||||
self.assertTrue(findings[1]["expected"])
|
||||
|
||||
|
||||
class _CmisHandler(BaseHTTPRequestHandler):
|
||||
def do_GET(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user