From 524259dc5eb50bb28c90bdcf1ca2c717a6cf42a4 Mon Sep 17 00:00:00 2001 From: "song.tianyang" Date: Wed, 24 Mar 2021 16:44:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=BA=E6=99=AF=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=8A=A5=E5=91=8A=E4=B8=80=E7=9B=B4running?= =?UTF-8?q?=EF=BC=8C=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=EF=BC=8C=20=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E4=B8=8D=E8=83=BD=E5=8F=91=E9=80=81=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 场景定时任务报告一直running,定时任务不能执行, 定时任务不能发送通知的问题 --- .../io/metersphere/api/jmeter/APIBackendListenerClient.java | 4 +--- .../java/io/metersphere/commons/constants/ApiRunMode.java | 2 +- .../java/io/metersphere/job/sechedule/ApiScenarioTestJob.java | 2 ++ 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java b/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java index 6e5c3b058f..9801009c1b 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java @@ -5,7 +5,6 @@ import io.metersphere.api.service.*; import io.metersphere.base.domain.ApiDefinitionExecResult; import io.metersphere.base.domain.ApiScenarioReport; import io.metersphere.base.domain.ApiTestReport; -import io.metersphere.base.domain.TestPlanReport; import io.metersphere.commons.constants.*; import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.LogUtil; @@ -15,7 +14,6 @@ import io.metersphere.notice.sender.NoticeModel; import io.metersphere.notice.service.NoticeSendService; import io.metersphere.service.SystemParameterService; import io.metersphere.track.service.TestPlanReportService; -import io.metersphere.track.service.TestPlanService; import io.metersphere.track.service.TestPlanTestCaseService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -206,7 +204,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl } else { apiDefinitionExecResultService.saveApiResult(testResult, ApiRunMode.API_PLAN.name()); } - } else if (StringUtils.equalsAny(this.runMode, ApiRunMode.SCENARIO.name(), ApiRunMode.SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name())) { + } else if (StringUtils.equalsAny(this.runMode, ApiRunMode.SCENARIO.name(), ApiRunMode.SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(),ApiRunMode.SCHEDULE_SCENARIO.name())) { // 执行报告不需要存储,由用户确认后在存储 testResult.setTestId(testId); ApiScenarioReport scenarioReport = apiScenarioReportService.complete(testResult, this.runMode); diff --git a/backend/src/main/java/io/metersphere/commons/constants/ApiRunMode.java b/backend/src/main/java/io/metersphere/commons/constants/ApiRunMode.java index b4a04a77cc..15283c30ef 100644 --- a/backend/src/main/java/io/metersphere/commons/constants/ApiRunMode.java +++ b/backend/src/main/java/io/metersphere/commons/constants/ApiRunMode.java @@ -1,5 +1,5 @@ package io.metersphere.commons.constants; public enum ApiRunMode { - RUN, DEBUG, DEFINITION, SCENARIO, API_PLAN, JENKINS_API_PLAN, JENKINS, SCENARIO_PLAN, API, SCHEDULE_API_PLAN, SCHEDULE_SCENARIO_PLAN, SCHEDULE_PERFORMANCE_TEST + RUN, DEBUG, DEFINITION, SCENARIO, API_PLAN, JENKINS_API_PLAN, JENKINS, SCENARIO_PLAN, API, SCHEDULE_API_PLAN, SCHEDULE_SCENARIO,SCHEDULE_SCENARIO_PLAN, SCHEDULE_PERFORMANCE_TEST } diff --git a/backend/src/main/java/io/metersphere/job/sechedule/ApiScenarioTestJob.java b/backend/src/main/java/io/metersphere/job/sechedule/ApiScenarioTestJob.java index e118c90cf9..bc8f80dd04 100644 --- a/backend/src/main/java/io/metersphere/job/sechedule/ApiScenarioTestJob.java +++ b/backend/src/main/java/io/metersphere/job/sechedule/ApiScenarioTestJob.java @@ -3,6 +3,7 @@ package io.metersphere.job.sechedule; import io.metersphere.api.dto.automation.ExecuteType; import io.metersphere.api.dto.automation.RunScenarioRequest; import io.metersphere.api.service.ApiAutomationService; +import io.metersphere.commons.constants.ApiRunMode; import io.metersphere.commons.constants.ReportTriggerMode; import io.metersphere.commons.constants.ScheduleGroup; import io.metersphere.commons.utils.CommonBeanFactory; @@ -58,6 +59,7 @@ public class ApiScenarioTestJob extends MsScheduleJob { request.setExecuteType(ExecuteType.Saved.name()); request.setIds(this.scenarioIds); request.setReportUserID(this.userId); + request.setRunMode(ApiRunMode.SCHEDULE_SCENARIO.name()); apiAutomationService.run(request); }