feat(shipping-notice): 增强订单抽取功能,添加进度事件和诊断运行管理,优化数据模型和访问控制
This commit is contained in:
1 parent
ce26d6d0c4
commit
c4095b08da
175 files changed
+13064
-1814
No files matched your search
@@ -486,6 +486,32 @@ def test_configuration_test_timeout_marks_run_failed(app, tmp_path):
|
||||
assert ShippingInventoryConfigurationTestRun.query.filter_by(run_no=started['run_no']).one().analysis_id is None
|
||||
|
||||
|
||||
def test_batch_configuration_test_timeout_scales_with_shared_worker_queue(app, tmp_path):
|
||||
"""同连接批量站点在 Worker 串行等待时,不得按单站时限提前失败。"""
|
||||
app.config['SHIPPING_NOTICE_RPA_CREDENTIAL_KEY'] = Fernet.generate_key().decode('ascii')
|
||||
app.config['SHIPPING_NOTICE_RPA_INVENTORY_TIMEOUT_SECONDS'] = 10
|
||||
with app.app_context(), patch(
|
||||
'app.services.shipping_notice.rpa.write_inventory_export_batch_trigger', return_value='trigger.json',
|
||||
):
|
||||
first = _source('TIMEOUT_QUEUE_A', 'TIMEOUT_QUEUE_LOGIN')
|
||||
second = _source('TIMEOUT_QUEUE_B', 'TIMEOUT_QUEUE_LOGIN_B')
|
||||
second_model = db.session.get(ShippingInventorySource, second['id'])
|
||||
second_model.rpa_profile_id = first['rpa_profile_id']
|
||||
second_model.config_version += 1
|
||||
db.session.commit()
|
||||
seed = _complete_test_run(first, tmp_path)
|
||||
profile = _publish_profile_from_analysis(seed['analysis_id'], _published_order_field(), code='TIMEOUT_QUEUE_PROFILE')
|
||||
shipping_inventory_service.bind_source_parsing_profile([first['id'], second['id']], profile['id'], actor_id=None, operation='bulk')
|
||||
batch = inventory_configuration_test.start_batch_test_export([first['id'], second['id']], actor_id=None)
|
||||
queued_run = ShippingInventoryConfigurationTestRun.query.filter_by(inventory_source_id=second['id']).one()
|
||||
queued_run.created_at = datetime.utcnow() - timedelta(seconds=15)
|
||||
db.session.commit()
|
||||
|
||||
recovered = inventory_configuration_test.get_validation_batch(batch['id'])
|
||||
# 关键断言:第二站可等待同组第一站完成,20 秒总窗口内不应被单站 10 秒误判。
|
||||
assert next(run for run in recovered['runs'] if run['inventory_source_id'] == second['id'])['status'] == 'awaiting_rpa'
|
||||
|
||||
|
||||
def test_confirming_test_profile_binds_only_compatible_published_profile(app, tmp_path):
|
||||
"""确认本次测试推荐的已发布方案后,才绑定库存站点并形成有效测试证据。"""
|
||||
app.config['SHIPPING_NOTICE_STORAGE_ROOT'] = str(tmp_path / 'shipping')
|
||||
|
||||
Reference in new issue
Block a user