fix(接口测试): 测试计划执行,资源池不可用,任务状态显示有误
--bug=1047861 --user=陈建星 【测试计划】资源池被禁用-执行计划-任务数据问题汇总 https://www.tapd.cn/55049933/s/1596223
This commit is contained in:
parent
4aabe786a0
commit
6293dd63fa
|
@ -209,7 +209,12 @@ public class ApiBatchRunBaseService {
|
||||||
return runModeConfig.getEnvironmentId();
|
return runModeConfig.getEnvironmentId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTaskStatus(String taskId) {
|
public void updateTaskCompletedStatus(String taskId) {
|
||||||
|
// 删除执行缓存
|
||||||
|
removeRunningTaskCache(taskId);
|
||||||
|
ExecTask originExecTask = execTaskMapper.selectByPrimaryKey(taskId);
|
||||||
|
// 出现异常,导致任务没有开始,则不更新任务状态
|
||||||
|
if (!StringUtils.equals(originExecTask.getStatus(), ExecStatus.PENDING.name())) {
|
||||||
// 更新任务状态
|
// 更新任务状态
|
||||||
ExecTask execTask = new ExecTask();
|
ExecTask execTask = new ExecTask();
|
||||||
execTask.setEndTime(System.currentTimeMillis());
|
execTask.setEndTime(System.currentTimeMillis());
|
||||||
|
@ -224,9 +229,11 @@ public class ApiBatchRunBaseService {
|
||||||
}
|
}
|
||||||
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