fix(cd): make controlled runtime migration test path stable
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 17s
CD Pipeline / build-and-deploy (push) Successful in 4m53s
CD Pipeline / post-deploy-checks (push) Successful in 1m7s

This commit is contained in:
Your Name
2026-06-29 17:39:38 +08:00
parent 81588f9a44
commit ceee2d9af3
2 changed files with 25 additions and 2 deletions

View File

@@ -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

View File

@@ -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 == []