From ceee2d9af3b67fa2a6444ec29ea894d6528e06bd Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 29 Jun 2026 17:39:38 +0800 Subject: [PATCH] fix(cd): make controlled runtime migration test path stable --- .../tests/test_awooop_truth_chain_service.py | 5 +++-- .../test_cd_controlled_runtime_profile.py | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/apps/api/tests/test_awooop_truth_chain_service.py b/apps/api/tests/test_awooop_truth_chain_service.py index 11d3bf4e..ce7ecd3c 100644 --- a/apps/api/tests/test_awooop_truth_chain_service.py +++ b/apps/api/tests/test_awooop_truth_chain_service.py @@ -1673,11 +1673,12 @@ def test_ansible_post_apply_km_writeback_is_idempotent_for_learning_backfill() - def test_ansible_learning_writeback_operation_type_has_schema_migration() -> None: + migrations_dir = Path(__file__).resolve().parents[1] / "migrations" migration = Path( - "apps/api/migrations/adr090e_ansible_learning_writeback_operation_type.sql" + migrations_dir / "adr090e_ansible_learning_writeback_operation_type.sql" ).read_text() down = Path( - "apps/api/migrations/adr090e_ansible_learning_writeback_operation_type_down.sql" + migrations_dir / "adr090e_ansible_learning_writeback_operation_type_down.sql" ).read_text() assert "ansible_learning_writeback_recorded" in migration diff --git a/ops/runner/test_cd_controlled_runtime_profile.py b/ops/runner/test_cd_controlled_runtime_profile.py index e3d45dfc..3ca51120 100644 --- a/ops/runner/test_cd_controlled_runtime_profile.py +++ b/ops/runner/test_cd_controlled_runtime_profile.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 from __future__ import annotations +import re from pathlib import Path @@ -185,3 +186,24 @@ def test_controlled_runtime_skips_b5_before_docker_socket_use() -> None: ) exit_zero = text.index("exit 0", controlled_gate) assert controlled_gate < exit_zero < docker_socket + + +def test_controlled_runtime_pytest_paths_exist() -> None: + text = _workflow_text() + block = text.split("PYTHONFAULTHANDLER=1 python3.11 -m pytest", 1)[1] + block = block.split("-v --tb=short", 1)[0] + path_tokens = sorted(set(re.findall( + r"((?:\.\./\.\./)?(?:tests|ops|scripts)/[A-Za-z0-9_./-]+\.py)", + block, + ))) + + missing: list[str] = [] + for token in path_tokens: + if token.startswith("tests/"): + path = ROOT / "apps/api" / token + else: + path = ROOT / token.removeprefix("../../") + if not path.exists(): + missing.append(token) + + assert missing == []