fix(测试计划): 性能测试批量执行执行状态未更新

--bug=1008253 --user=lyh 【测试计划】性能测试批量执行,报告已经出来了,但是执行状态一直是run(单独执行正常)
https://www.tapd.cn/55049933/s/1074755
This commit is contained in:
shiziyuan9527 2021-11-24 19:47:07 +08:00 committed by 刘瑞斌
parent ae86fbb3d5
commit d258bed56e
3 changed files with 3 additions and 17 deletions

View File

@ -10,5 +10,6 @@ public enum ReportTriggerMode {
CASE,
TEST_PLAN_SCHEDULE,
TEST_PLAN_API,
API_PLAN
API_PLAN,
BATCH
}

View File

@ -36,6 +36,7 @@ public class LoadReportStatusEvent implements LoadTestFinishEvent {
@Override
public void execute(LoadTestReport loadTestReport) {
if (StringUtils.equals(ReportTriggerMode.MANUAL.name(), loadTestReport.getTriggerMode())
|| StringUtils.equals(ReportTriggerMode.BATCH.name(), loadTestReport.getTriggerMode())
|| StringUtils.equals(ReportTriggerMode.TEST_PLAN_SCHEDULE.name(), loadTestReport.getTriggerMode())
|| StringUtils.equals(ReportTriggerMode.TEST_PLAN_API.name(), loadTestReport.getTriggerMode())) {
if (StringUtils.equalsAny(loadTestReport.getStatus(),

View File

@ -81,25 +81,9 @@ public class TestPlanLoadCaseService {
public List<TestPlanLoadCaseDTO> list(LoadCaseRequest request) {
request.setOrders(ServiceUtils.getDefaultSortOrder(request.getOrders()));
List<TestPlanLoadCaseDTO> testPlanLoadCaseDTOList = extTestPlanLoadCaseMapper.selectTestPlanLoadCaseList(request);
this.syncReportStatus(testPlanLoadCaseDTOList);
return testPlanLoadCaseDTOList;
}
private void syncReportStatus(List<TestPlanLoadCaseDTO> testPlanLoadCaseDTOList) {
for (TestPlanLoadCaseDTO dto : testPlanLoadCaseDTOList) {
if (StringUtils.isNotEmpty(dto.getLoadReportId()) && StringUtils.equalsIgnoreCase(dto.getStatus(), "run")) {
LoadTestReport report = loadTestReportMapper.selectByPrimaryKey(dto.getLoadReportId());
if (report != null && StringUtils.equalsAnyIgnoreCase(report.getStatus(), "Starting", "Running", "Reporting")) {
dto.setStatus(report.getStatus());
TestPlanLoadCaseWithBLOBs updateModel = new TestPlanLoadCaseWithBLOBs();
updateModel.setId(dto.getId());
updateModel.setStatus(report.getStatus());
testPlanLoadCaseMapper.updateByPrimaryKeySelective(updateModel);
}
}
}
}
public List<String> selectTestPlanLoadCaseIds(LoadCaseRequest request) {
request.setOrders(ServiceUtils.getDefaultSortOrder(request.getOrders()));
return extTestPlanLoadCaseMapper.selectTestPlanLoadCaseId(request);