This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Phase-1.0CM measured 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 Phase10CMGuardrails(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
cls.data = json.loads((root / "manifests/retroarch/phase-1.0cm-measured-configure-timeout-correction-gate.json").read_text(encoding="utf-8"))
|
||||
|
||||
def test_parent_and_measurement(self) -> None:
|
||||
parent = root / "manifests/retroarch/phase-1.0cl-native-sdk-configure-progress-and-cleanup-gate.json"
|
||||
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(), self.data["source_bindings"]["phase10cl_manifest_sha256"])
|
||||
self.assertEqual(self.data["measurement"]["completed_checks"], 96)
|
||||
self.assertEqual(self.data["measurement"]["selected_bound_seconds"], 1800)
|
||||
|
||||
def test_only_timeout_source_change(self) -> None:
|
||||
correction = self.data["authorized_source_correction"]
|
||||
self.assertEqual(correction["old_timeout_seconds"], 600)
|
||||
self.assertEqual(correction["new_timeout_seconds"], 1800)
|
||||
for key in ("argv_change_authorized", "output_limit_change_authorized",
|
||||
"checkout_timeout_change_authorized",
|
||||
"build_timeout_change_authorized", "automatic_retry"):
|
||||
self.assertFalse(correction[key], key)
|
||||
auth = self.data["authorizations"]
|
||||
self.assertTrue(auth["request_graph_source_change_authorized"])
|
||||
for key, value in auth.items():
|
||||
if key != "request_graph_source_change_authorized":
|
||||
self.assertFalse(value, key)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(argv=[__file__])
|
||||
Reference in New Issue
Block a user