From 1689b29b02032bc72ec50e87861a088c7e151654 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Mon, 6 Jun 2022 15:27:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20je?= =?UTF-8?q?nkins=E6=89=A7=E8=A1=8C=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E5=86=8D=E4=BC=9A=E5=90=8C=E6=97=B6=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E7=9A=84=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=92=8C=E5=9C=BA=E6=99=AF=E7=94=A8=E4=BE=8B=E7=9A=84?= =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1013358 --user=宋天阳 【消息通知】用jenkins 跑一个包含100+ 场景的测试计划,邮箱收到100+条通知,建议只接收执行该测试计划的一个通知 https://www.tapd.cn/55049933/s/1173807 --- .../io/metersphere/api/service/ApiScenarioReportService.java | 4 ++++ .../io/metersphere/commons/constants/ReportTriggerMode.java | 1 + .../java/io/metersphere/track/service/TestPlanService.java | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java index 6c01776212..5e628fe04c 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java @@ -221,6 +221,10 @@ public class ApiScenarioReportService { if (StringUtils.equals(reportType, RunModeConstants.SET_REPORT.toString())) { return report; } + if(StringUtils.equalsAnyIgnoreCase(report.getTriggerMode(),ReportTriggerMode.JENKINS_RUN_TEST_PLAN.name())){ + //jenkins运行测试计划时执行的场景,触发方式改回API + report.setTriggerMode(ReportTriggerMode.API.name()); + } if (runMode.equals("CASE")) { report.setTriggerMode(TriggerMode.MANUAL.name()); } diff --git a/backend/src/main/java/io/metersphere/commons/constants/ReportTriggerMode.java b/backend/src/main/java/io/metersphere/commons/constants/ReportTriggerMode.java index 8a8d45c35d..f0e591a216 100644 --- a/backend/src/main/java/io/metersphere/commons/constants/ReportTriggerMode.java +++ b/backend/src/main/java/io/metersphere/commons/constants/ReportTriggerMode.java @@ -4,6 +4,7 @@ public enum ReportTriggerMode { MANUAL, SCHEDULE, API, + JENKINS_RUN_TEST_PLAN, /** * 性能测试用例执行触发报告 */ diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index bf42246ced..5bddc52bf4 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -1020,7 +1020,7 @@ public class TestPlanService { scenarioRequest.setReportId(scenarioReportID); scenarioRequest.setProjectId(projectID); if (StringUtils.equals(triggerMode, ReportTriggerMode.API.name())) { - scenarioRequest.setTriggerMode(ReportTriggerMode.API.name()); + scenarioRequest.setTriggerMode(ReportTriggerMode.JENKINS_RUN_TEST_PLAN.name()); scenarioRequest.setRunMode(ApiRunMode.JENKINS_SCENARIO_PLAN.name()); } else if (StringUtils.equals(triggerMode, ReportTriggerMode.MANUAL.name())) { scenarioRequest.setTriggerMode(ReportTriggerMode.MANUAL.name());