Merge branch 'dev' into hugo-shipping-notice
This commit is contained in:
commit
6684e7181a
9 files changed
+107
-99
No files matched your search
@@ -0,0 +1,21 @@
|
||||
"""
|
||||
backend/tests/test_inventory_candidate_freeze_migration_revision.py
|
||||
|
||||
用途:验证库存候选冻结迁移的父 revision 同时覆盖正式 Notice 与候选冻结依赖链。
|
||||
依赖:cp1a2b3c4d5e 迁移模块。
|
||||
逻辑:候选冻结表声明引用 shipping_notices、review/process/routing 表,必须在包含
|
||||
co9f0a1b2c3d 祖先链的数据库状态上执行;单独依赖 dc9a4a2683df 会导致父表缺失。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
|
||||
|
||||
def test_candidate_freeze_migration_depends_on_notice_schema_chain():
|
||||
"""关键断言:候选冻结迁移必须等待 dc9 merge 与 Notice 迁移链共同完成。"""
|
||||
migration = importlib.import_module(
|
||||
'migrations.versions.cp1a2b3c4d5e_add_inventory_candidate_freeze_tables',
|
||||
)
|
||||
|
||||
assert set(migration.down_revision) == {'dc9a4a2683df', 'co9f0a1b2c3d'}
|
||||
@@ -0,0 +1,21 @@
|
||||
"""
|
||||
backend/tests/test_line_match_evidence_migration_revision.py
|
||||
|
||||
用途:验证行级库存匹配证据字段迁移的父 revision 覆盖目标表创建链。
|
||||
依赖:er5f6g7h8i9j 迁移模块。
|
||||
逻辑:目标表由 cr2b3c4d5e6f 创建,库存 RPA 表由 dq2e3f4g5h6i 链提供;
|
||||
迁移必须以双父 revision 合并两条链,避免 PostgreSQL 在 ALTER TABLE 时缺表。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
|
||||
|
||||
def test_line_match_evidence_migration_merges_match_and_rpa_chains():
|
||||
"""关键断言:证据字段迁移同时依赖匹配表链和库存 RPA 链。"""
|
||||
migration = importlib.import_module(
|
||||
'migrations.versions.er5f6g7h8i9j_add_line_match_evidence_fields',
|
||||
)
|
||||
|
||||
assert set(migration.down_revision) == {'dq2e3f4g5h6i', 'cs3c4d5e6f7a'}
|
||||
@@ -0,0 +1,34 @@
|
||||
"""
|
||||
backend/tests/test_order_profile_template_mode_migration_revision.py
|
||||
|
||||
用途:验证订单 Profile 模式收敛迁移在建表迁移之后执行。
|
||||
依赖:ab2c3d4e5f6a 与 a68f8091a2b4 migration metadata。
|
||||
逻辑:目标表 shipping_order_document_profiles 由 a68f8091a2b4 创建,
|
||||
因此本迁移必须直接接在该 revision 后,避免先执行 UPDATE/ALTER TABLE 时缺表。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import ast
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def _revision_metadata(path: Path) -> dict[str, object]:
|
||||
tree = ast.parse(path.read_text(encoding='utf-8-sig'))
|
||||
values: dict[str, object] = {}
|
||||
for node in tree.body:
|
||||
if isinstance(node, ast.Assign):
|
||||
for target in node.targets:
|
||||
if isinstance(target, ast.Name) and target.id in {'revision', 'down_revision'}:
|
||||
values[target.id] = ast.literal_eval(node.value)
|
||||
return values
|
||||
|
||||
|
||||
def test_profile_template_mode_migration_follows_profile_table_creation():
|
||||
"""关键断言:模式收敛迁移直接依赖 Profile 建表迁移。"""
|
||||
migration = _revision_metadata(Path(
|
||||
'backend/migrations/versions/ab1c2d3e4f5a_unify_order_profile_template_mode.py',
|
||||
))
|
||||
|
||||
assert migration['revision'] == 'ab2c3d4e5f6a'
|
||||
assert migration['down_revision'] == 'a68f8091a2b4'
|
||||
@@ -0,0 +1,21 @@
|
||||
"""
|
||||
backend/tests/test_process_gate_healthcheck_script.py
|
||||
|
||||
用途:验证部署健康检查不再把 Process Gate 模块能力作为全局发布门禁。
|
||||
依赖:scripts/healthcheck.sh。
|
||||
逻辑:脚本只负责 Compose 服务启动检查;Process Gate 能力由应用运行时按需校验。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def test_healthcheck_does_not_gate_global_deploy_on_process_gate():
|
||||
"""关键断言:基础部署检查不再执行 Process Gate 专项探针。"""
|
||||
script = Path('scripts/healthcheck.sh').read_text(encoding='utf-8')
|
||||
|
||||
assert 'Process Gate' not in script
|
||||
assert 'enqueue_process_gate_healthcheck_probe' not in script
|
||||
assert 'shipping_process_gate' not in script
|
||||
assert 'required_services=(hxops-backend hxops-shipping-worker)' in script
|
||||
Reference in new issue
Block a user