This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Phase-1.0BS status-timeout guardrails."""
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--root", type=Path, required=True)
|
||||
root = parser.parse_args().root
|
||||
|
||||
|
||||
class Phase10BSGuardrails(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
cls.data = json.loads((root / "manifests/retroarch/phase-1.0bs-read-only-status-timeout.json").read_text(encoding="utf-8"))
|
||||
|
||||
def test_parent_and_exact_stop(self) -> None:
|
||||
parent = root / "manifests/retroarch/phase-1.0br-script-entrypoint-one-shot-gate.json"
|
||||
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(), self.data["source_bindings"]["phase10br_manifest_sha256"])
|
||||
result = self.data["consumed_attempt"]
|
||||
self.assertEqual(result["completed_operations"], ["verify_sdl_commit"])
|
||||
self.assertEqual(result["failed_operation"], "verify_sdl_clean")
|
||||
self.assertTrue(result["process_group_terminated"])
|
||||
for key in ("stage_created", "cmake_invoked", "sdl_build_invoked", "retroarch_build_invoked", "device_action_invoked"):
|
||||
self.assertFalse(result[key], key)
|
||||
for key in ("stage_absent_after", "build_absent_after", "archive_absent_after"):
|
||||
self.assertTrue(result[key], key)
|
||||
|
||||
def test_correction_and_authority_are_narrow(self) -> None:
|
||||
correction = self.data["correction_contract"]
|
||||
self.assertEqual(correction["operation"], "verify_sdl_clean")
|
||||
self.assertTrue(correction["argv_unchanged"])
|
||||
self.assertTrue(correction["output_limit_unchanged"])
|
||||
self.assertEqual(correction["new_timeout_seconds"], 120)
|
||||
auth = self.data["authorizations"]
|
||||
self.assertTrue(auth["status_timeout_source_correction_authorized"])
|
||||
for key, value in auth.items():
|
||||
if key != "status_timeout_source_correction_authorized":
|
||||
self.assertFalse(value, key)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(argv=[__file__])
|
||||
Reference in New Issue
Block a user