fix(测试跟踪): 修复测试跟踪批量串行测试计划第二个开始不执行的问题

--bug=1020888 --user=宋天阳
【测试跟踪】批量执行两个测试计划失败,状态一直是running,超时结束后报告为空-打开报告卡死
https://www.tapd.cn/55049933/s/1316575
This commit is contained in:
song-tianyang 2022-12-16 23:40:30 +08:00 committed by 建国
parent 2d8dff550f
commit 579b2b5d56
1 changed files with 12 additions and 2 deletions

View File

@ -560,7 +560,7 @@ public class TestPlanReportService {
resourceId = planExecutionQueues.get(0).getResourceId(); resourceId = planExecutionQueues.get(0).getResourceId();
testPlanExecutionQueueMapper.deleteByExample(testPlanExecutionQueueExample); testPlanExecutionQueueMapper.deleteByExample(testPlanExecutionQueueExample);
} }
testPlanReportMapper.updateByPrimaryKey(testPlanReport); testPlanReportMapper.updateByPrimaryKey(testPlanReport);
//发送通知 //发送通知
testPlanMessageService.checkTestPlanStatusAndSendMessage(testPlanReport, content, isSendMessage); testPlanMessageService.checkTestPlanStatusAndSendMessage(testPlanReport, content, isSendMessage);
@ -579,7 +579,17 @@ public class TestPlanReportService {
TestPlanRequestUtil.changeStringToBoolean(jsonObject); TestPlanRequestUtil.changeStringToBoolean(jsonObject);
TestPlanRunRequest runRequest = JSON.parseObject(JSON.toJSONString(jsonObject), TestPlanRunRequest.class); TestPlanRunRequest runRequest = JSON.parseObject(JSON.toJSONString(jsonObject), TestPlanRunRequest.class);
runRequest.setReportId(testPlanExecutionQueue.getReportId()); runRequest.setReportId(testPlanExecutionQueue.getReportId());
testPlanService.runPlan(runRequest); runRequest.setTestPlanId(testPlan.getId());
try {
HttpHeaderUtils.runAsUser("admin");
//如果运行测试计划的过程中出现异常则整个事务会回滚 删除队列的事务也不会提交也不会执行后面的测试计划
testPlanService.runPlan(runRequest);
} catch (Exception e) {
LogUtil.error("执行队列中的下一个测试计划失败! ", e);
this.finishedTestPlanReport(runRequest.getReportId(), TestPlanReportStatus.FAILED.name());
} finally {
HttpHeaderUtils.clearUser();
}
} }
} }