68 lines
2.9 KiB
Python
68 lines
2.9 KiB
Python
from __future__ import annotations
|
|
|
|
import json
|
|
from pathlib import Path
|
|
import unittest
|
|
|
|
|
|
META_ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
class ReleaseEntrypointGateTests(unittest.TestCase):
|
|
def test_lockstep_release_includes_every_registered_module_and_connector(self) -> None:
|
|
script = (META_ROOT / "tools" / "release" / "push-release-tag.sh").read_text()
|
|
registry = json.loads((META_ROOT / "repositories.json").read_text())
|
|
|
|
expected = {
|
|
item["name"]
|
|
for item in registry["repositories"]
|
|
if item["category"] not in {"system", "website"}
|
|
}
|
|
missing = sorted(repo for repo in expected if f'$PARENT/{repo}"' not in script)
|
|
|
|
self.assertEqual([], missing)
|
|
|
|
def test_lockstep_release_runs_source_and_full_gates_before_remote_push(self) -> None:
|
|
script = (META_ROOT / "tools" / "release" / "push-release-tag.sh").read_text()
|
|
workflow = script.rsplit("\nconfirm_release\n", 1)[1]
|
|
|
|
source_gate = workflow.index("run_version_alignment_gate source")
|
|
first_commit = workflow.index('run git -C "$repo" commit')
|
|
lock_generation = workflow.index("generate_release_lock")
|
|
full_gate = workflow.index("run_version_alignment_gate", source_gate + 1)
|
|
first_push = workflow.index('run git -C "$repo" push')
|
|
|
|
self.assertLess(source_gate, first_commit)
|
|
self.assertLess(first_commit, lock_generation)
|
|
self.assertLess(lock_generation, full_gate)
|
|
self.assertLess(full_gate, first_push)
|
|
|
|
def test_source_catalog_generator_enforces_explicit_repo_versions(self) -> None:
|
|
script = (META_ROOT / "tools" / "release" / "generate-release-catalog.py").read_text()
|
|
|
|
gate = script.index("selected_repository_version_issues(")
|
|
write = script.index("output.write_text(")
|
|
|
|
self.assertLess(gate, write)
|
|
|
|
def test_candidate_publication_uses_existing_keyring_as_trust_anchor(self) -> None:
|
|
publisher = (META_ROOT / "tools" / "release" / "govoplan_release" / "publisher.py").read_text()
|
|
|
|
self.assertIn("candidate_catalog_version_issues(candidate_payload)", publisher)
|
|
self.assertIn("trusted_keys_from_keyring(\n target_keyring_payload", publisher)
|
|
self.assertIn("trusted_keys=publication_trust", publisher)
|
|
self.assertNotIn("trusted_keys=candidate_keys", publisher)
|
|
self.assertIn("write_module_directory(", publisher)
|
|
self.assertNotIn("shutil.copytree(candidate_modules", publisher)
|
|
|
|
def test_release_integration_honors_independent_module_versions(self) -> None:
|
|
script = (META_ROOT / "tools" / "checks" / "check-release-integration.sh").read_text()
|
|
|
|
self.assertNotIn('expected_tag = os.environ["RELEASE_TAG"]', script)
|
|
self.assertIn('dependency_version = tag_match.group(1)', script)
|
|
self.assertIn('repo_tag="$(release_tag_for_package "$repo")"', script)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|