From ad11cc380b3664180c417cc877557093b27abc61 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Wed, 9 Nov 2022 17:46:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=BA=E6=99=AF=E6=89=A7=E8=A1=8C=E5=AE=8C?= =?UTF-8?q?=E8=BF=98=E6=98=AFpending=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1019544 --user=赵勇 【任务中心】有一个场景执行完并且显示执行结果了,但是任务中心一直是pending状态 https://www.tapd.cn/55049933/s/1293843 --- .../api/jmeter/utils/ReportStatusUtil.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/api-test/backend/src/main/java/io/metersphere/api/jmeter/utils/ReportStatusUtil.java b/api-test/backend/src/main/java/io/metersphere/api/jmeter/utils/ReportStatusUtil.java index 1069b02f35..e868dd883e 100644 --- a/api-test/backend/src/main/java/io/metersphere/api/jmeter/utils/ReportStatusUtil.java +++ b/api-test/backend/src/main/java/io/metersphere/api/jmeter/utils/ReportStatusUtil.java @@ -52,8 +52,7 @@ public class ReportStatusUtil { } if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey(CommonConstants.REPORT_STATUS)) { // 资源池执行整体传输失败,单条传输内容,获取资源池执行统计的状态 - ResultVO o = (ResultVO) dto.getArbitraryData().get(CommonConstants.REPORT_STATUS); - resultVO.setStatus(o.getStatus()); + resultVO.setStatus(JSONUtil.convertValue(dto.getArbitraryData().get(CommonConstants.REPORT_STATUS), ResultVO.class).getStatus()); } // 过滤掉重试结果后进行统计 List requestResults = filterRetryResults(dto.getRequestResults()); @@ -65,7 +64,8 @@ public class ReportStatusUtil { // 默认状态 String status = dto.getRequestResults().isEmpty() && StringUtils.isEmpty(resultVO.getStatus()) ? ApiReportStatus.PENDING.name() - : StringUtils.defaultIfEmpty(resultVO.getStatus(), ApiReportStatus.SUCCESS.name()); + : ApiReportStatus.SUCCESS.name(); + if (errorSize > 0) { status = ApiReportStatus.ERROR.name(); } else if (errorReportResultSize > 0) { @@ -87,13 +87,15 @@ public class ReportStatusUtil { if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey(CommonConstants.LOCAL_STATUS_KEY)) { // 本地执行状态 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)) { // 资源池执行整体传输失败,单条传输内容,获取资源池执行统计的状态 result = JSONUtil.convertValue(dto.getArbitraryData().get(CommonConstants.REPORT_STATUS), ResultVO.class); - return result; } - return getStatus(dto, result); + result = getStatus(dto, result); + if (result != null && result.getScenarioTotal() > 0 && result.getScenarioTotal() == result.getScenarioSuccess()) { + result.setStatus(ApiReportStatus.SUCCESS.name()); + } + return result; } }