fix(接口测试): 兼容历史数据

This commit is contained in:
fit2-zhao 2022-01-13 17:07:40 +08:00 committed by fit2-zhao
parent 7bbb4115c3
commit 636c8311dc
4 changed files with 7 additions and 8 deletions

View File

@ -10,7 +10,7 @@ import org.springframework.stereotype.Component;
public class FixedTask { public class FixedTask {
private ApiExecutionQueueService queueService; private ApiExecutionQueueService queueService;
@Scheduled(cron = "0 */2 * * * ?") @Scheduled(cron = "0 0/2 * * * ?")
public void execute() { public void execute() {
if (queueService == null) { if (queueService == null) {
queueService = CommonBeanFactory.getBean(ApiExecutionQueueService.class); queueService = CommonBeanFactory.getBean(ApiExecutionQueueService.class);

View File

@ -237,15 +237,16 @@ public class ApiExecutionQueueService {
if (report != null && StringUtils.equalsAny(report.getStatus(), TestPlanReportStatus.RUNNING.name()) && report.getUpdateTime() < now) { if (report != null && StringUtils.equalsAny(report.getStatus(), TestPlanReportStatus.RUNNING.name()) && report.getUpdateTime() < now) {
report.setStatus(ScenarioStatus.Timeout.name()); report.setStatus(ScenarioStatus.Timeout.name());
apiScenarioReportMapper.updateByPrimaryKeySelective(report); apiScenarioReportMapper.updateByPrimaryKeySelective(report);
executionQueueDetailMapper.deleteByPrimaryKey(item.getId());
} }
} else { } else {
ApiDefinitionExecResult result = apiDefinitionExecResultMapper.selectByPrimaryKey(item.getReportId()); ApiDefinitionExecResult result = apiDefinitionExecResultMapper.selectByPrimaryKey(item.getReportId());
if (result != null && StringUtils.equalsAny(result.getStatus(), TestPlanReportStatus.RUNNING.name())) { if (result != null && StringUtils.equalsAny(result.getStatus(), TestPlanReportStatus.RUNNING.name())) {
result.setStatus(ScenarioStatus.Timeout.name()); result.setStatus(ScenarioStatus.Timeout.name());
apiDefinitionExecResultMapper.updateByPrimaryKeySelective(result); apiDefinitionExecResultMapper.updateByPrimaryKeySelective(result);
executionQueueDetailMapper.deleteByPrimaryKey(item.getId());
} }
} }
executionQueueDetailMapper.deleteByPrimaryKey(item.getId());
}); });
} }

View File

@ -40,7 +40,7 @@ export default {
sort(stepArray) { sort(stepArray) {
if (stepArray) { if (stepArray) {
for (let i in stepArray) { for (let i in stepArray) {
if (!stepArray[i].clazzName) { if (stepArray[i] && TYPE_TO_C.get(stepArray[i].type) && !stepArray[i].clazzName) {
stepArray[i].clazzName = TYPE_TO_C.get(stepArray[i].type); stepArray[i].clazzName = TYPE_TO_C.get(stepArray[i].type);
} }
if (stepArray[i].type === "Assertions" && !stepArray[i].document) { if (stepArray[i].type === "Assertions" && !stepArray[i].document) {

View File

@ -762,11 +762,9 @@ export default {
this.messageWebSocket.onmessage = this.onDebugMessage; this.messageWebSocket.onmessage = this.onDebugMessage;
}, },
runningEditParent(node) { runningEditParent(node) {
if (node) { if (node.parent && node.parent.data && node.parent.data.id) {
node.data.testing = true; node.data.testing = true;
if (node.parent && node.parent.data && node.parent.data.id) { this.runningEditParent(node.parent);
this.runningEditParent(node.parent);
}
} }
}, },
runningNodeChild(arr, resultData) { runningNodeChild(arr, resultData) {
@ -1466,7 +1464,7 @@ export default {
formatData(hashTree) { formatData(hashTree) {
for (let i in hashTree) { for (let i in hashTree) {
if (!hashTree[i].clazzName) { if (hashTree[i] && TYPE_TO_C.get(hashTree[i].type) && !hashTree[i].clazzName) {
hashTree[i].clazzName = TYPE_TO_C.get(hashTree[i].type); hashTree[i].clazzName = TYPE_TO_C.get(hashTree[i].type);
} }
if (hashTree[i] && hashTree[i].authManager && !hashTree[i].authManager.clazzName) { if (hashTree[i] && hashTree[i].authManager && !hashTree[i].authManager.clazzName) {