Selaa lähdekoodia

test: define Kestra and n8n navigation boundary

马小龙 3 päivää sitten
vanhempi
commit
f795ef8473
1 muutettua tiedostoa jossa 68 lisäystä ja 0 poistoa
  1. 68 0
      tests/test_data_factory_orchestration_navigation_contract.py

+ 68 - 0
tests/test_data_factory_orchestration_navigation_contract.py

@@ -0,0 +1,68 @@
+import re
+from pathlib import Path
+
+
+ROOT = Path(__file__).resolve().parents[1]
+ROUTES = ROOT / "frontend/src/router/routes.js"
+N8N_PAGE = ROOT / "frontend/src/views/dataFactory/workflow/index.vue"
+KESTRA_PAGE = ROOT / "frontend/src/views/dataFactory/productionLineDeployment/index.vue"
+
+
+def _data_factory_child_route_block(routes, name):
+    data_factory_start = routes.index("path: '/dataFactory',")
+    children_start = routes.index("children: [", data_factory_start)
+    children_end = routes.index("      ],", children_start)
+    children = routes[children_start:children_end]
+    name_marker = f"          name: '{name}',"
+
+    assert name_marker in children, f"missing Data Factory child route: {name}"
+
+    name_position = children.index(name_marker)
+    block_start = children.rfind("        {\n", 0, name_position)
+    block_end = children.index("        },", name_position) + len("        },")
+    return children[block_start:block_end]
+
+
+def test_data_factory_exposes_independent_kestra_and_legacy_n8n_navigation():
+    routes = ROUTES.read_text(encoding="utf-8")
+    kestra = _data_factory_child_route_block(routes, "productionLineDeployment")
+    legacy_production_line = _data_factory_child_route_block(routes, "productionLine")
+    legacy_workflow = _data_factory_child_route_block(routes, "workflowIndex")
+
+    assert "title: '数据生产线投产'" in kestra
+    assert "label: '数据生产线投产'" in kestra
+    assert "path: '/dataFactory/production-line-deployment'" in kestra
+    assert "component: 'dataFactory/productionLineDeployment'" in kestra
+
+    assert "title: 'n8n 生产线管理(待下线)'" in legacy_production_line
+    assert "label: 'n8n 生产线管理(待下线)'" in legacy_production_line
+    assert "path: process.env.VUE_APP_N8N_URL" in legacy_production_line
+    assert "target: true" in legacy_production_line
+
+    assert "title: 'n8n 工作流管理(待下线)'" in legacy_workflow
+    assert "label: 'n8n 工作流管理(待下线)'" in legacy_workflow
+    assert "path: '/dataFactory/workflow'" in legacy_workflow
+    assert "component: 'dataFactory/workflow'" in legacy_workflow
+    assert "target: false" in legacy_workflow
+
+    kestra_marker = "          name: 'productionLineDeployment',"
+    legacy_production_marker = "          name: 'productionLine',"
+    legacy_workflow_marker = "          name: 'workflowIndex',"
+    assert routes.index(kestra_marker) < routes.index(legacy_production_marker)
+    assert routes.index(legacy_production_marker) < routes.index(legacy_workflow_marker)
+
+
+def test_kestra_page_is_not_owned_by_the_n8n_workflow_page():
+    legacy = N8N_PAGE.read_text(encoding="utf-8")
+
+    tabs = re.findall(r"<v-tab>(.*?)</v-tab>", legacy)
+    assert tabs == ["工作流列表", "执行记录", "健康检查"]
+
+    assert KESTRA_PAGE.is_file(), f"missing dedicated Kestra page: {KESTRA_PAGE}"
+    kestra = KESTRA_PAGE.read_text(encoding="utf-8")
+
+    assert "ProductionLineDeployment" not in legacy
+    assert "productionLineDeployment" not in legacy
+    assert "import ProductionLineDeployment" not in legacy
+    assert "DATA FACTORY · GOVERNED RELEASE" in kestra
+    assert "Kestra revision" in kestra