mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-25 11:17:40 -05:00
Runners bill each job rounded up to the minute, and every job restored and built the shared projects again. The small suites and the synthetic nests now share one job that builds once; Engine.Tests, the longest, runs beside it. A newer push cancels a stale run, and pushes that change only docs or Markdown skip CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
56 lines
2.0 KiB
Python
56 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Fail-closed tests for the exact command used by the final CI check."""
|
|
|
|
from pathlib import Path
|
|
import subprocess
|
|
import unittest
|
|
|
|
|
|
CHECK = Path(__file__).resolve().with_name("check-ci-results.sh")
|
|
|
|
|
|
class CIResultsTests(unittest.TestCase):
|
|
def check(self, *results):
|
|
return subprocess.run(
|
|
["bash", str(CHECK), *results],
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=5,
|
|
)
|
|
|
|
def test_both_required_jobs_successful(self):
|
|
self.assertEqual(self.check("success", "success").returncode, 0)
|
|
|
|
def test_suites_failure_blocks_aggregate(self):
|
|
self.assertNotEqual(self.check("failure", "success").returncode, 0)
|
|
|
|
def test_engine_failure_blocks_aggregate(self):
|
|
self.assertNotEqual(self.check("success", "failure").returncode, 0)
|
|
|
|
def test_canceled_dependency_blocks_aggregate(self):
|
|
for results in [("cancelled", "success"), ("success", "cancelled")]:
|
|
with self.subTest(results=results):
|
|
self.assertNotEqual(self.check(*results).returncode, 0)
|
|
|
|
def test_skipped_dependency_blocks_aggregate(self):
|
|
for results in [("skipped", "success"), ("success", "skipped")]:
|
|
with self.subTest(results=results):
|
|
self.assertNotEqual(self.check(*results).returncode, 0)
|
|
|
|
def test_empty_unknown_and_nonliteral_results_block_aggregate(self):
|
|
for result in ["", "unknown", "SUCCESS", "success failure", "success\nsuccess"]:
|
|
with self.subTest(result=result):
|
|
self.assertNotEqual(self.check(result, "success").returncode, 0)
|
|
self.assertNotEqual(self.check("success", result).returncode, 0)
|
|
|
|
def test_missing_required_result_blocks_aggregate(self):
|
|
self.assertNotEqual(self.check().returncode, 0)
|
|
self.assertNotEqual(self.check("success").returncode, 0)
|
|
|
|
def test_extra_result_blocks_aggregate(self):
|
|
self.assertNotEqual(self.check("success", "success", "success").returncode, 0)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|