From 3bded248d03ad5e069c2d97efadf557f595b3538 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Thu, 24 Nov 2022 13:59:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E8=AF=AF=E6=8A=A5=E8=A7=A3=E6=9E=90=E6=96=B9=E6=B3=95=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=9B=B8=E5=85=B3=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 误报解析方法增加相关日志 --- .../metersphere/commons/utils/ErrorReportLibraryUtil.java | 7 ++++++- .../java/io/metersphere/commons/utils/ResponseUtil.java | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/api-test/backend/src/main/java/io/metersphere/commons/utils/ErrorReportLibraryUtil.java b/api-test/backend/src/main/java/io/metersphere/commons/utils/ErrorReportLibraryUtil.java index 7a0a20f1cb..416cfb6a46 100644 --- a/api-test/backend/src/main/java/io/metersphere/commons/utils/ErrorReportLibraryUtil.java +++ b/api-test/backend/src/main/java/io/metersphere/commons/utils/ErrorReportLibraryUtil.java @@ -143,13 +143,18 @@ public class ErrorReportLibraryUtil { } }); } - LogUtil.info(" FAKE_ERROR result: config-higherThanError:" + higherThanError + ", config-higherThanSuccess:" + higherThanSuccess + ", resultIsSuccess: " + resultIsSuccess); + if (CollectionUtils.isNotEmpty(result.errorCodeList)) { if ((higherThanError && !resultIsSuccess) || (higherThanSuccess && resultIsSuccess)) { result.requestStatus = ApiReportStatus.FAKE_ERROR.name(); } } } + LogUtil.info(" FAKE_ERROR result: config-higherThanError:" + higherThanError + + ", config-higherThanSuccess:" + higherThanSuccess + + ", resultIsSuccess: " + resultIsSuccess + + ", isFakeError: " + ((higherThanError && !resultIsSuccess) || (higherThanSuccess && resultIsSuccess)) + + "; status:" + result.requestStatus); return result; } diff --git a/api-test/backend/src/main/java/io/metersphere/commons/utils/ResponseUtil.java b/api-test/backend/src/main/java/io/metersphere/commons/utils/ResponseUtil.java index 85d55e65d2..c25f29fd9b 100644 --- a/api-test/backend/src/main/java/io/metersphere/commons/utils/ResponseUtil.java +++ b/api-test/backend/src/main/java/io/metersphere/commons/utils/ResponseUtil.java @@ -35,10 +35,14 @@ public class ResponseUtil { expandMap.put("status", ApiReportStatus.FAKE_ERROR.name()); } expandDTO.setAttachInfoMap(expandMap); + LogUtil.info(" FAKE_ERROR result.id:" + errorCodeDTO.getRequestStatus() + "; AttachInfoMap:" + JSON.toJSONString(expandDTO.getAttachInfoMap())); } if (StringUtils.equalsIgnoreCase(errorCodeDTO.getRequestStatus(), ApiReportStatus.FAKE_ERROR.name())) { expandDTO.setStatus(errorCodeDTO.getRequestStatus()); } + LogUtil.info(" FAKE_ERROR result.id:" + errorCodeDTO.getRequestStatus() + + ";status:" + expandDTO.getStatus() + + " AttachInfoMap:" + (expandDTO.getAttachInfoMap() == null ? "null" : JSON.toJSONString(expandDTO.getAttachInfoMap()))); return expandDTO; }