fix(测试计划): 测试集跟父节点串并行配置不一致时,报告无法结束

This commit is contained in:
AgAngle 2024-06-18 10:38:26 +08:00 committed by Craftsman
parent 6d5923f8a6
commit c564a5b8f5
2 changed files with 10 additions and 2 deletions

View File

@ -127,6 +127,13 @@ public class MessageListener {
}
}
} catch (Exception e) {
// 串行执行异常清空队列
if (StringUtils.isNotBlank(dto.getQueueId())) {
apiExecutionQueueService.deleteQueue(dto.getQueueId());
}
if (StringUtils.isNotBlank(dto.getParentQueueId())) {
apiExecutionQueueService.deleteQueue(dto.getParentQueueId());
}
LogUtils.error("执行任务失败:", e);
}
}

View File

@ -371,6 +371,7 @@ public class TestPlanExecuteService {
String queueId = executionQueue.getPrepareReportId() + "_" + parentCollection.getId();
String queueType = QUEUE_PREFIX_TEST_PLAN_COLLECTION;
String runMode = executionQueue.getRunMode();
for (TestPlanCollection collection : childrenList) {
childrenQueue.add(
new TestPlanExecutionQueue(
@ -382,7 +383,7 @@ public class TestPlanExecuteService {
executionQueue.getQueueId(),
executionQueue.getQueueType(),
collection.getId(),
collection.getExecuteMethod(),
runMode,
executionQueue.getExecutionSource(),
executionQueue.getPrepareReportId()) {{
this.setTestPlanCollectionJson(JSON.toJSONString(collection));
@ -395,7 +396,7 @@ public class TestPlanExecuteService {
this.caseTypeExecuteQueueFinish(executionQueue.getQueueId(), executionQueue.getQueueType());
} else {
this.setRedisForList(genQueueKey(queueId, queueType), childrenQueue.stream().map(JSON::toJSONString).toList());
if (StringUtils.equalsIgnoreCase(parentCollection.getExecuteMethod(), ApiBatchRunMode.SERIAL.name())) {
if (StringUtils.equalsIgnoreCase(runMode, ApiBatchRunMode.SERIAL.name())) {
//串行
TestPlanExecutionQueue nextQueue = this.getNextQueue(queueId, queueType);
this.executeCase(nextQueue);