Files
acdl/tests/test_consumer_guide_per_env_section.py
T
Jon Chery 25427250ad
acdl-ci / Lint (push) Successful in 9s
acdl-ci / Test (push) Failing after 22s
acdl-ci / Platform check-only (offline) (push) Successful in 24s
Nova Slides Render / render (push) Failing after 24s
docs(P1): consumer guide accuracy fixes — REQ-276..281,290
- Step 3 contract fields table: stale uses/module → real id/name/environment/infrastructure (REQ-276)
- Step 4 caller: add environment: dev to match Step 2 (REQ-277)
- Step 5 stage 8: (dev only) → (autonomous in dev; higher envs apply after HITL) (REQ-278)
- Step 8: rewrite with Shape A destroy-then-rebuild + Shape B cross-ref (REQ-279)
- Per-env section: add Shape B lead sentence (REQ-280)
- Reference table: @v1.19 wording + .yaml→.yml extension fix (REQ-281)
- Tests: rename no-field-editing → both-promotion-shapes + new destroy-on-env-change test (REQ-290)

---ci---
project: acdl
phase: 1
milestone: v1.24
status: execute
requirements: [REQ-276,REQ-277,REQ-278,REQ-279,REQ-280,REQ-281,REQ-290]
---/ci---
2026-08-12 14:26:22 +00:00

76 lines
3.1 KiB
Python

"""REQ-106 + REQ-290: consumer guide documents both promotion shapes.
Shape A (Step 8): edit the environment field → platform destroys the prior
env before building the new env (no orphan path).
Shape B (Per-environment deployment): per-env caller workflows, no field
editing, promotion = running the matching job.
"""
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
GUIDE = ROOT / "docs" / "consumer-guide.md"
def test_consumer_guide_has_per_env_section():
text = GUIDE.read_text()
assert "Per-environment deployment" in text
assert "promotion-without-editing" in text.lower() or "promotion = running the matching job" in text.lower()
def test_consumer_guide_has_four_caller_examples():
text = GUIDE.read_text()
assert "deploy-dev" in text
assert "deploy-qa" in text
assert "deploy-prod" in text
assert "deploy-dr" in text
def test_consumer_guide_documents_environment_input():
text = GUIDE.read_text()
assert "environment" in text
assert "workflow input" in text.lower() or "workflow_call" in text.lower() or "environment:" in text
def test_consumer_guide_documents_hitl_gates():
text = GUIDE.read_text()
assert "approve_qa" in text
assert "approve_prod" in text
assert "approve_dr" in text
assert "separation-of-duties" in text.lower() or "separation of duties" in text.lower()
def test_consumer_guide_has_interpolation_reference():
text = GUIDE.read_text()
assert "${env.environment}" in text
assert "${env.account_id}" in text
# P57: contract.module was dropped in favor of contract.id (short acronym)
assert "${contract.id}" in text
# The old token must not survive the P57 contract redesign
assert "${contract.module}" not in text
def test_consumer_guide_documents_both_promotion_shapes():
"""REQ-290: the guide documents both Shape A (edit + destroy) and
Shape B (per-env caller workflows). Replaces the old
test_consumer_guide_states_no_field_editing which asserted only
Shape B."""
text = GUIDE.read_text()
# Shape B: per-env caller workflows, no field editing
assert "Per-environment deployment" in text
assert "promotion-without-editing" in text.lower() or "promotion = running the matching job" in text.lower()
# Shape A: edit environment field (Step 8 documents this as a valid path)
assert "Shape A" in text or "Shape B" in text
assert "edit the environment field" in text.lower() or "change `environment`" in text.lower() or "change \"environment\"" in text.lower()
def test_consumer_guide_documents_destroy_on_env_change():
"""REQ-290: the guide states the platform destroys the prior env's
resources when the environment field is changed, and that there is no
orphan path."""
text = GUIDE.read_text()
text_lower = text.lower()
# The guide must state the platform destroys the prior environment
assert "destroy" in text_lower and ("prior environment" in text_lower or "prior env" in text_lower)
# The guide must state there is no orphan path / fail closed
assert "no orphan path" in text_lower or "orphan" in text_lower
assert "fail closed" in text_lower or "fails closed" in text_lower