fix(接口测试): 修复场景执行完还是pending的缺陷

--bug=1019544 --user=赵勇 【任务中心】有一个场景执行完并且显示执行结果了,但是任务中心一直是pending状态
https://www.tapd.cn/55049933/s/1293843
This commit is contained in:
wxg0103 2022-11-09 17:46:12 +08:00 committed by wxg0103
parent eb7f9bd214
commit ad11cc380b
1 changed files with 8 additions and 6 deletions

View File

@ -52,8 +52,7 @@ public class ReportStatusUtil {
} }
if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey(CommonConstants.REPORT_STATUS)) { if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey(CommonConstants.REPORT_STATUS)) {
// 资源池执行整体传输失败单条传输内容获取资源池执行统计的状态 // 资源池执行整体传输失败单条传输内容获取资源池执行统计的状态
ResultVO o = (ResultVO) dto.getArbitraryData().get(CommonConstants.REPORT_STATUS); resultVO.setStatus(JSONUtil.convertValue(dto.getArbitraryData().get(CommonConstants.REPORT_STATUS), ResultVO.class).getStatus());
resultVO.setStatus(o.getStatus());
} }
// 过滤掉重试结果后进行统计 // 过滤掉重试结果后进行统计
List<RequestResult> requestResults = filterRetryResults(dto.getRequestResults()); List<RequestResult> requestResults = filterRetryResults(dto.getRequestResults());
@ -65,7 +64,8 @@ public class ReportStatusUtil {
// 默认状态 // 默认状态
String status = dto.getRequestResults().isEmpty() && StringUtils.isEmpty(resultVO.getStatus()) String status = dto.getRequestResults().isEmpty() && StringUtils.isEmpty(resultVO.getStatus())
? ApiReportStatus.PENDING.name() ? ApiReportStatus.PENDING.name()
: StringUtils.defaultIfEmpty(resultVO.getStatus(), ApiReportStatus.SUCCESS.name()); : ApiReportStatus.SUCCESS.name();
if (errorSize > 0) { if (errorSize > 0) {
status = ApiReportStatus.ERROR.name(); status = ApiReportStatus.ERROR.name();
} else if (errorReportResultSize > 0) { } else if (errorReportResultSize > 0) {
@ -87,13 +87,15 @@ public class ReportStatusUtil {
if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey(CommonConstants.LOCAL_STATUS_KEY)) { if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey(CommonConstants.LOCAL_STATUS_KEY)) {
// 本地执行状态 // 本地执行状态
result = JSONUtil.convertValue(dto.getArbitraryData().get(CommonConstants.LOCAL_STATUS_KEY), ResultVO.class); result = JSONUtil.convertValue(dto.getArbitraryData().get(CommonConstants.LOCAL_STATUS_KEY), ResultVO.class);
return result;
} }
if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey(CommonConstants.REPORT_STATUS)) { if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey(CommonConstants.REPORT_STATUS)) {
// 资源池执行整体传输失败单条传输内容获取资源池执行统计的状态 // 资源池执行整体传输失败单条传输内容获取资源池执行统计的状态
result = JSONUtil.convertValue(dto.getArbitraryData().get(CommonConstants.REPORT_STATUS), ResultVO.class); result = JSONUtil.convertValue(dto.getArbitraryData().get(CommonConstants.REPORT_STATUS), ResultVO.class);
}
result = getStatus(dto, result);
if (result != null && result.getScenarioTotal() > 0 && result.getScenarioTotal() == result.getScenarioSuccess()) {
result.setStatus(ApiReportStatus.SUCCESS.name());
}
return result; return result;
} }
return getStatus(dto, result);
}
} }