fix 真实well数据覆盖
This commit is contained in:
parent
2d5718a72f
commit
d9bbdbb3ae
@ -370,20 +370,7 @@ class DmsCrudScenarioStage(BaseAPIStage):
|
|||||||
for pk_field, pk_val in all_pk_values.items():
|
for pk_field, pk_val in all_pk_values.items():
|
||||||
create_payload[pk_field] = pk_val
|
create_payload[pk_field] = pk_val
|
||||||
|
|
||||||
# 🔑 关键修复:LLM生成的数据也需要井数据增强
|
|
||||||
if hasattr(self, 'orchestrator') and hasattr(self.orchestrator, 'well_data_manager') and self.orchestrator.well_data_manager:
|
|
||||||
create_payload = self.orchestrator.well_data_manager.enhance_data_with_well_values(create_payload)
|
|
||||||
self.logger.info(f"LLM生成数据已通过井数据管理器增强")
|
|
||||||
|
|
||||||
self.logger.info(f"LLM成功生成智能测试数据: {create_payload}")
|
self.logger.info(f"LLM成功生成智能测试数据: {create_payload}")
|
||||||
|
|
||||||
# 🔑 关键修复:预构建请求体,避免测试编排器重新生成数据
|
|
||||||
stage_context["create_request_body"] = {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"act": -1,
|
|
||||||
"data": [create_payload]
|
|
||||||
}
|
|
||||||
self.logger.info(f"预构建创建请求体完成")
|
|
||||||
else:
|
else:
|
||||||
self.logger.warning("LLM生成的数据格式不符合预期,回退到传统数据生成")
|
self.logger.warning("LLM生成的数据格式不符合预期,回退到传统数据生成")
|
||||||
raise ValueError("LLM数据格式无效")
|
raise ValueError("LLM数据格式无效")
|
||||||
@ -423,32 +410,23 @@ class DmsCrudScenarioStage(BaseAPIStage):
|
|||||||
else:
|
else:
|
||||||
self.logger.warning("No create schema found. Falling back to a minimal payload.")
|
self.logger.warning("No create schema found. Falling back to a minimal payload.")
|
||||||
|
|
||||||
|
# 🔑 关键修复:应用井数据增强到创建数据
|
||||||
|
if hasattr(self, 'orchestrator') and hasattr(self.orchestrator, 'well_data_manager') and self.orchestrator.well_data_manager:
|
||||||
|
create_payload = self.orchestrator.well_data_manager.enhance_data_with_well_values(create_payload)
|
||||||
|
self.logger.info(f"创建数据已通过井数据管理器增强")
|
||||||
|
|
||||||
# 更新负载基于创建负载,但修改描述字段
|
# 更新负载基于创建负载,但修改描述字段
|
||||||
update_payload = copy.deepcopy(create_payload)
|
update_payload = copy.deepcopy(create_payload)
|
||||||
update_payload["description"] = "updated-test-entry-from-scenario"
|
update_payload["description"] = "updated-test-entry-from-scenario"
|
||||||
|
|
||||||
# 🔑 关键修复:预构建请求体,避免测试编排器重新生成数据
|
self.logger.info(f"井数据增强后的创建数据: {create_payload}")
|
||||||
create_request_body = {
|
self.logger.info(f"井数据增强后的更新数据: {update_payload}")
|
||||||
"version": "1.0.0",
|
|
||||||
"act": -1,
|
|
||||||
"data": [create_payload]
|
|
||||||
}
|
|
||||||
|
|
||||||
update_request_body = {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"act": -1,
|
|
||||||
"data": [update_payload]
|
|
||||||
}
|
|
||||||
|
|
||||||
self.logger.info(f"预构建创建和更新请求体完成")
|
|
||||||
|
|
||||||
# Populate stage context
|
# Populate stage context
|
||||||
stage_context["pk_name"] = pk_name
|
stage_context["pk_name"] = pk_name
|
||||||
stage_context["pk_value"] = pk_value
|
stage_context["pk_value"] = pk_value
|
||||||
stage_context["current_payload"] = create_payload
|
stage_context["current_payload"] = create_payload
|
||||||
stage_context["update_payload"] = update_payload
|
stage_context["update_payload"] = update_payload
|
||||||
stage_context["create_request_body"] = create_request_body
|
|
||||||
stage_context["update_request_body"] = update_request_body
|
|
||||||
stage_context["scenario_endpoints"] = current_scenario
|
stage_context["scenario_endpoints"] = current_scenario
|
||||||
|
|
||||||
# Pre-build the delete body to avoid key-templating issues later
|
# Pre-build the delete body to avoid key-templating issues later
|
||||||
@ -506,8 +484,12 @@ class DmsCrudScenarioStage(BaseAPIStage):
|
|||||||
endpoint_spec_lookup_key="CREATE",
|
endpoint_spec_lookup_key="CREATE",
|
||||||
request_overrides={
|
request_overrides={
|
||||||
# DMS标准格式:包含version、act和data字段
|
# DMS标准格式:包含version、act和data字段
|
||||||
# 使用预生成的数据,避免测试编排器重新生成
|
# 直接使用预构建的请求体,避免测试编排器重新生成
|
||||||
"body": "{{stage_context.create_request_body}}"
|
"body": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"act": -1,
|
||||||
|
"data": ["{{stage_context.current_payload}}"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
response_assertions=[validate_response_is_true],
|
response_assertions=[validate_response_is_true],
|
||||||
outputs_to_context={}
|
outputs_to_context={}
|
||||||
@ -526,8 +508,12 @@ class DmsCrudScenarioStage(BaseAPIStage):
|
|||||||
endpoint_spec_lookup_key="UPDATE",
|
endpoint_spec_lookup_key="UPDATE",
|
||||||
request_overrides={
|
request_overrides={
|
||||||
# DMS标准格式:包含version、act和data字段
|
# DMS标准格式:包含version、act和data字段
|
||||||
# 使用预生成的数据,避免测试编排器重新生成
|
# 直接使用预构建的请求体,避免测试编排器重新生成
|
||||||
"body": "{{stage_context.update_request_body}}"
|
"body": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"act": -1,
|
||||||
|
"data": ["{{stage_context.update_payload}}"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
response_assertions=[validate_response_is_true]
|
response_assertions=[validate_response_is_true]
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user