feat(测试跟踪): 修复测试计划在发送通知时报错导致测试报告状态无法改变,而引起来的检查逻辑重复尝试更新这个测试计划状态的缺陷

--bug=1012609 --user=宋天阳 [测试计划]-确认该测试计划没有任何定时任务-2分钟收到一次通知邮件,报告中链接打开失败
https://www.tapd.cn/55049933/s/1145281
This commit is contained in:
song-tianyang 2022-04-24 11:57:40 +08:00 committed by 刘瑞斌
parent 1183cddd71
commit b17065c3db
1 changed files with 34 additions and 28 deletions

View File

@ -738,7 +738,8 @@ public class TestPlanReportService {
}
public TestPlanReport update(TestPlanReport report) {
if (!report.getIsApiCaseExecuting() && !report.getIsPerformanceExecuting() && !report.getIsScenarioExecuting())
testPlanReportMapper.updateByPrimaryKey(report);
if (!report.getIsApiCaseExecuting() && !report.getIsPerformanceExecuting() && !report.getIsScenarioExecuting()) {
try {
//更新TestPlan状态为完成
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(report.getTestPlanId());
@ -749,15 +750,20 @@ public class TestPlanReportService {
if (testPlan != null && StringUtils.equalsAny(report.getTriggerMode(),
ReportTriggerMode.MANUAL.name(),
ReportTriggerMode.API.name(),
ReportTriggerMode.SCHEDULE.name())
ReportTriggerMode.SCHEDULE.name()) && !StringUtils.equalsIgnoreCase(report.getStatus(), ExecuteResult.RUNNING.name())
) {
try {
//发送通知
sendMessage(report, testPlan.getProjectId());
} catch (Exception e) {
LogUtil.error("Send message error: " + e.getMessage());
}
}
} catch (Exception e) {
LogUtil.error(e);
LogUtil.error(e.getMessage());
}
}
testPlanReportMapper.updateByPrimaryKey(report);
return report;
}