fix(接口测试): 测试计划执行,资源池不可用,任务状态显示有误
--bug=1047861 --user=陈建星 【测试计划】资源池被禁用-执行计划-任务数据问题汇总 https://www.tapd.cn/55049933/s/1596223
This commit is contained in:
parent
4aabe786a0
commit
6293dd63fa
|
@ -209,24 +209,31 @@ public class ApiBatchRunBaseService {
|
||||||
return runModeConfig.getEnvironmentId();
|
return runModeConfig.getEnvironmentId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTaskStatus(String taskId) {
|
public void updateTaskCompletedStatus(String taskId) {
|
||||||
// 更新任务状态
|
// 删除执行缓存
|
||||||
ExecTask execTask = new ExecTask();
|
removeRunningTaskCache(taskId);
|
||||||
execTask.setEndTime(System.currentTimeMillis());
|
ExecTask originExecTask = execTaskMapper.selectByPrimaryKey(taskId);
|
||||||
execTask.setId(taskId);
|
// 出现异常,导致任务没有开始,则不更新任务状态
|
||||||
execTask.setStatus(ExecStatus.COMPLETED.name());
|
if (!StringUtils.equals(originExecTask.getStatus(), ExecStatus.PENDING.name())) {
|
||||||
if (extExecTaskItemMapper.hasErrorItem(taskId)) {
|
// 更新任务状态
|
||||||
execTask.setResult(ResultStatus.ERROR.name());
|
ExecTask execTask = new ExecTask();
|
||||||
} else if (extExecTaskItemMapper.hasFakeErrorItem(taskId)) {
|
execTask.setEndTime(System.currentTimeMillis());
|
||||||
execTask.setResult(ResultStatus.FAKE_ERROR.name());
|
execTask.setId(taskId);
|
||||||
} else {
|
execTask.setStatus(ExecStatus.COMPLETED.name());
|
||||||
execTask.setResult(ResultStatus.SUCCESS.name());
|
if (extExecTaskItemMapper.hasErrorItem(taskId)) {
|
||||||
|
execTask.setResult(ResultStatus.ERROR.name());
|
||||||
|
} else if (extExecTaskItemMapper.hasFakeErrorItem(taskId)) {
|
||||||
|
execTask.setResult(ResultStatus.FAKE_ERROR.name());
|
||||||
|
} else {
|
||||||
|
execTask.setResult(ResultStatus.SUCCESS.name());
|
||||||
|
}
|
||||||
|
execTaskMapper.updateByPrimaryKeySelective(execTask);
|
||||||
}
|
}
|
||||||
execTaskMapper.updateByPrimaryKeySelective(execTask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清理正在运行的任务缓存
|
* 清理正在运行的任务缓存
|
||||||
|
*
|
||||||
* @param taskId
|
* @param taskId
|
||||||
*/
|
*/
|
||||||
public void removeRunningTaskCache(String taskId) {
|
public void removeRunningTaskCache(String taskId) {
|
||||||
|
|
|
@ -175,8 +175,7 @@ public class TestPlanApiCaseBatchRunService {
|
||||||
ExecutionQueue collectionQueue = apiExecutionQueueService.getQueue(collectionQueueId);
|
ExecutionQueue collectionQueue = apiExecutionQueueService.getQueue(collectionQueueId);
|
||||||
if (collectionQueue == null) {
|
if (collectionQueue == null) {
|
||||||
// 失败停止,或者执行完成,更新任务状态
|
// 失败停止,或者执行完成,更新任务状态
|
||||||
apiBatchRunBaseService.updateTaskStatus(collectionQueueId);
|
apiBatchRunBaseService.updateTaskCompletedStatus(collectionQueueId);
|
||||||
apiBatchRunBaseService.removeRunningTaskCache(collectionQueueId);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String userId = collectionQueue.getUserId();
|
String userId = collectionQueue.getUserId();
|
||||||
|
|
|
@ -200,8 +200,7 @@ public class TestPlanApiScenarioBatchRunService {
|
||||||
ExecutionQueue collectionQueue = apiExecutionQueueService.getQueue(collectionQueueId);
|
ExecutionQueue collectionQueue = apiExecutionQueueService.getQueue(collectionQueueId);
|
||||||
if (collectionQueue == null) {
|
if (collectionQueue == null) {
|
||||||
// 失败停止,或者执行完成,更新任务状态
|
// 失败停止,或者执行完成,更新任务状态
|
||||||
apiBatchRunBaseService.updateTaskStatus(collectionQueueId);
|
apiBatchRunBaseService.updateTaskCompletedStatus(collectionQueueId);
|
||||||
apiBatchRunBaseService.removeRunningTaskCache(collectionQueueId);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String userId = collectionQueue.getUserId();
|
String userId = collectionQueue.getUserId();
|
||||||
|
|
|
@ -687,8 +687,7 @@ public class TestPlanExecuteService {
|
||||||
TestPlanReport testPlanReport = testPlanReportMapper.selectByPrimaryKey(reportId);
|
TestPlanReport testPlanReport = testPlanReportMapper.selectByPrimaryKey(reportId);
|
||||||
if (StringUtils.equals(testPlanReport.getParentId(), reportId) && StringUtils.isNotBlank(taskId)) {
|
if (StringUtils.equals(testPlanReport.getParentId(), reportId) && StringUtils.isNotBlank(taskId)) {
|
||||||
// 执行完成,更新任务状态
|
// 执行完成,更新任务状态
|
||||||
apiBatchRunBaseService.updateTaskStatus(taskId);
|
apiBatchRunBaseService.updateTaskCompletedStatus(taskId);
|
||||||
apiBatchRunBaseService.removeRunningTaskCache(taskId);
|
|
||||||
}
|
}
|
||||||
testPlanExecuteSupportService.summaryTestPlanReport(reportId, isGroupReport, isStop);
|
testPlanExecuteSupportService.summaryTestPlanReport(reportId, isGroupReport, isStop);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue