refactor(测试跟踪): 限制测试计划定时任务单一执行

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-08-23 17:47:27 +08:00 committed by fit2-zhao
parent e87e920ccd
commit 747ca01483
2 changed files with 4 additions and 4 deletions

View File

@ -155,7 +155,7 @@
</select>
<select id="selectLastReportByTestPlanId" resultType="java.lang.String">
select `status` from test_plan_report where test_plan_id = #{testPlanId} ORDER BY create_time DESC LIMIT 1
select `status` from test_plan_report where test_plan_id = #{testPlanId} and trigger_mode = 'SCHEDULE' ORDER BY create_time DESC LIMIT 1
</select>

View File

@ -71,7 +71,7 @@ public class TestPlanExecuteService {
}
TestPlanReport testPlanReport = null;
try {
this.checkTestPlanCanRunning(testPlanId, projectId, runModeConfig);
this.checkTestPlanCanRunning(testPlanId, projectId, runModeConfig, triggerMode);
//创建测试报告然后返回的ID重新赋值为resourceID作为后续的参数
TestPlanScheduleReportInfoDTO reportInfoDTO = testPlanService.genTestPlanReport(planReportId, testPlanId, userId, triggerMode, runModeConfig);
testPlanReport = reportInfoDTO.getTestPlanReport();
@ -89,10 +89,10 @@ public class TestPlanExecuteService {
return planReportId;
}
private void checkTestPlanCanRunning(String testPlanId, String projectId, RunModeConfigDTO runModeConfig) throws Exception {
private void checkTestPlanCanRunning(String testPlanId, String projectId, RunModeConfigDTO runModeConfig, String triggerMode) throws Exception {
// 校验测试计划是否在执行中
if (testPlanService.checkTestPlanIsRunning(testPlanId)) {
if (StringUtils.startsWith(triggerMode, "SCHEDULE") && testPlanService.checkTestPlanIsRunning(testPlanId)) {
LogUtil.info("当前测试计划正在执行中,请稍后再试", testPlanId);
MSException.throwException(Translator.get("test_plan_run_message"));