Accept flat-spec input aliases across generators
All checks were successful
Deploy Skill to OCI / deploy (push) Successful in 20s
All checks were successful
Deploy Skill to OCI / deploy (push) Successful in 20s
Harden bizcase, bom, deck, and diagram generators to tolerate payload shape variants (metadata/cover/summary/line_item aliases, current_state as string, alternate pillar keys) so MCP and CLI flat specs render consistently. Add input-alias tests per generator. Also loosen KB governance tests to handle multi-document service YAMLs with optional changelogs, untrack the customer demo output under examples/output-demo-pharma-mx/ (matches .gitignore), and ship an ADB-S vs Aurora 500GB sample deck. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
76
tests/test_oci_diagram_gen_input_aliases.py
Normal file
76
tests/test_oci_diagram_gen_input_aliases.py
Normal file
@@ -0,0 +1,76 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parent.parent
|
||||
TOOLS_DIR = PROJECT_ROOT / "tools"
|
||||
|
||||
if str(TOOLS_DIR) not in sys.path:
|
||||
sys.path.insert(0, str(TOOLS_DIR))
|
||||
|
||||
from oci_diagram_gen import OCIDiagramGenerator
|
||||
|
||||
|
||||
def test_from_spec_accepts_name_aliases_and_generates_ids():
|
||||
spec = {
|
||||
"external": [{"name": "Users"}],
|
||||
"clouds": [{"name": "AWS", "services": [{"name": "EC2 App", "service_type": "ec2"}]}],
|
||||
"tenancy": {
|
||||
"regions": [
|
||||
{
|
||||
"name": "Ashburn",
|
||||
"vcns": [
|
||||
{
|
||||
"name": "App VCN",
|
||||
"subnets": [
|
||||
{"name": "App Subnet", "services": [{"name": "App VM"}]}
|
||||
],
|
||||
}
|
||||
],
|
||||
}
|
||||
]
|
||||
},
|
||||
"on_prem": {"name": "Primary DC", "services": [{"name": "Legacy DB"}]},
|
||||
}
|
||||
|
||||
gen = OCIDiagramGenerator.from_spec(spec)
|
||||
values = [getattr(obj, "value", "") for obj in gen._objects.values()]
|
||||
|
||||
assert "Users" in values
|
||||
assert "AWS" in values
|
||||
assert "Ashburn" in values
|
||||
assert "VCN App VCN" in values
|
||||
assert "App Subnet" in values
|
||||
assert "App VM" in values
|
||||
assert "Primary DC" in values
|
||||
assert "Legacy DB" in values
|
||||
|
||||
|
||||
def test_from_spec_accepts_source_target_and_omits_unresolved_connections():
|
||||
spec = {
|
||||
"external": [{"name": "Users"}],
|
||||
"tenancy": {
|
||||
"regions": [
|
||||
{
|
||||
"name": "Ashburn",
|
||||
"vcns": [
|
||||
{
|
||||
"name": "App VCN",
|
||||
"subnets": [
|
||||
{"name": "App Subnet", "services": [{"name": "App VM"}]}
|
||||
],
|
||||
}
|
||||
],
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": [
|
||||
{"source": "Users", "target": "App VM", "type": "standard", "label": "HTTPS"},
|
||||
{"from": "Users", "to": "App VM", "type": "standard", "label": "Duplicate"},
|
||||
{"source": "Users", "target": "Missing VM", "type": "standard", "label": "Broken"},
|
||||
],
|
||||
}
|
||||
|
||||
gen = OCIDiagramGenerator.from_spec(spec)
|
||||
|
||||
assert gen._connection_count == 1
|
||||
Reference in New Issue
Block a user