refactor(接口测试): 优化超时时间处理

This commit is contained in:
fit2-zhao 2022-01-14 10:17:59 +08:00 committed by fit2-zhao
parent 89ec3025ce
commit 6e99229bfc
6 changed files with 101 additions and 91 deletions

View File

@ -101,7 +101,7 @@ public class ApiCaseExecuteService {
String reportType = request.getConfig().getReportType(); String reportType = request.getConfig().getReportType();
String poolId = request.getConfig().getResourcePoolId(); String poolId = request.getConfig().getResourcePoolId();
String runMode = StringUtils.equals(request.getTriggerMode(), TriggerMode.MANUAL.name()) ? ApiRunMode.API_PLAN.name() : ApiRunMode.SCHEDULE_API_PLAN.name(); String runMode = StringUtils.equals(request.getTriggerMode(), TriggerMode.MANUAL.name()) ? ApiRunMode.API_PLAN.name() : ApiRunMode.SCHEDULE_API_PLAN.name();
DBTestQueue deQueue = apiExecutionQueueService.add(executeQueue, poolId, ApiRunMode.API_PLAN.name(), request.getPlanReportId(), reportType, runMode, request.getConfig().getEnvMap(), request.getConfig().isOnSampleError()); DBTestQueue deQueue = apiExecutionQueueService.add(executeQueue, poolId, ApiRunMode.API_PLAN.name(), request.getPlanReportId(), reportType, runMode, request.getConfig());
// 开始选择执行模式 // 开始选择执行模式
if (request.getConfig() != null && request.getConfig().getMode().equals(RunModeConstants.SERIAL.toString())) { if (request.getConfig() != null && request.getConfig().getMode().equals(RunModeConstants.SERIAL.toString())) {
@ -178,7 +178,7 @@ public class ApiCaseExecuteService {
String reportType = request.getConfig().getReportType(); String reportType = request.getConfig().getReportType();
String poolId = request.getConfig().getResourcePoolId(); String poolId = request.getConfig().getResourcePoolId();
DBTestQueue deQueue = apiExecutionQueueService.add(executeQueue, poolId, ApiRunMode.DEFINITION.name(), null, reportType, ApiRunMode.DEFINITION.name(), request.getConfig().getEnvMap(), request.getConfig().isOnSampleError()); DBTestQueue deQueue = apiExecutionQueueService.add(executeQueue, poolId, ApiRunMode.DEFINITION.name(), null, reportType, ApiRunMode.DEFINITION.name(), request.getConfig());
// 开始选择执行模式 // 开始选择执行模式
if (request.getConfig().getMode().equals(RunModeConstants.SERIAL.toString())) { if (request.getConfig().getMode().equals(RunModeConstants.SERIAL.toString())) {
LoggerUtil.debug("开始串行执行"); LoggerUtil.debug("开始串行执行");

View File

@ -34,7 +34,7 @@ public class ApiCaseParallelExecuteService {
String reportId = result.getId(); String reportId = result.getId();
HashTree hashTree = null; HashTree hashTree = null;
if (!GenerateHashTreeUtil.isResourcePool(config.getResourcePoolId()).isPool()) { if (!GenerateHashTreeUtil.isResourcePool(config.getResourcePoolId()).isPool()) {
hashTree = apiScenarioSerialService.generateHashTree(testId, executionQueue.getRunMode(), config.getEnvMap()); hashTree = apiScenarioSerialService.generateHashTree(testId, config.getEnvMap());
} }
JmeterRunRequestDTO runRequest = new JmeterRunRequestDTO(testId, reportId, runMode, hashTree); JmeterRunRequestDTO runRequest = new JmeterRunRequestDTO(testId, reportId, runMode, hashTree);
runRequest.setPool(GenerateHashTreeUtil.isResourcePool(config.getResourcePoolId())); runRequest.setPool(GenerateHashTreeUtil.isResourcePool(config.getResourcePoolId()));

View File

@ -167,8 +167,7 @@ public class ApiScenarioExecuteService {
String reportType = request.getConfig().getReportType(); String reportType = request.getConfig().getReportType();
String planReportId = StringUtils.isNotEmpty(request.getTestPlanReportId()) ? request.getTestPlanReportId() : serialReportId; String planReportId = StringUtils.isNotEmpty(request.getTestPlanReportId()) ? request.getTestPlanReportId() : serialReportId;
DBTestQueue executionQueue = apiExecutionQueueService.add(executeQueue, request.getConfig().getResourcePoolId() DBTestQueue executionQueue = apiExecutionQueueService.add(executeQueue, request.getConfig().getResourcePoolId()
, ApiRunMode.SCENARIO.name(), planReportId, reportType, request.getRunMode(), request.getConfig().getEnvMap() , ApiRunMode.SCENARIO.name(), planReportId, reportType, request.getRunMode(), request.getConfig());
, request.getConfig().isOnSampleError());
if (request.getConfig() != null && request.getConfig().getMode().equals(RunModeConstants.SERIAL.toString())) { if (request.getConfig() != null && request.getConfig().getMode().equals(RunModeConstants.SERIAL.toString())) {
if (StringUtils.isNotEmpty(serialReportId)) { if (StringUtils.isNotEmpty(serialReportId)) {

View File

@ -104,7 +104,7 @@ public class ApiScenarioSerialService {
if (StringUtils.isNotEmpty(queue.getEvnMap())) { if (StringUtils.isNotEmpty(queue.getEvnMap())) {
map = JSON.parseObject(queue.getEvnMap(), Map.class); map = JSON.parseObject(queue.getEvnMap(), Map.class);
} }
hashTree = generateHashTree(queue.getTestId(), queue.getType(), map); hashTree = generateHashTree(queue.getTestId(), map);
} }
// 更新环境变量 // 更新环境变量
this.initEnv(hashTree); this.initEnv(hashTree);
@ -152,12 +152,10 @@ public class ApiScenarioSerialService {
hashTreeUtil.mergeParamDataMap(null, envParamsMap); hashTreeUtil.mergeParamDataMap(null, envParamsMap);
} }
public HashTree generateHashTree(String testId, String type, Map<String, String> envMap) { public HashTree generateHashTree(String testId, Map<String, String> envMap) {
ApiTestCaseWithBLOBs caseWithBLOBs = null; ApiTestCaseWithBLOBs caseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(testId);
String envId = null; String envId = null;
if (StringUtils.equals(type, ApiRunMode.DEFINITION.name())) { if (caseWithBLOBs == null) {
caseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(testId);
} else {
TestPlanApiCase apiCase = testPlanApiCaseMapper.selectByPrimaryKey(testId); TestPlanApiCase apiCase = testPlanApiCaseMapper.selectByPrimaryKey(testId);
if (apiCase != null) { if (apiCase != null) {
caseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(apiCase.getApiCaseId()); caseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(apiCase.getApiCaseId());

View File

@ -19,6 +19,7 @@ import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.constants.RunModeConstants; import io.metersphere.constants.RunModeConstants;
import io.metersphere.dto.ResultDTO; import io.metersphere.dto.ResultDTO;
import io.metersphere.dto.RunModeConfigDTO;
import io.metersphere.track.service.TestPlanReportService; import io.metersphere.track.service.TestPlanReportService;
import io.metersphere.utils.LoggerUtil; import io.metersphere.utils.LoggerUtil;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
@ -57,12 +58,12 @@ public class ApiExecutionQueueService {
@Resource @Resource
private ExtApiExecutionQueueMapper extApiExecutionQueueMapper; private ExtApiExecutionQueueMapper extApiExecutionQueueMapper;
public DBTestQueue add(Object runObj, String poolId, String type, String reportId, String reportType, String runMode, Map<String, String> envMap, boolean failure) { public DBTestQueue add(Object runObj, String poolId, String type, String reportId, String reportType, String runMode, RunModeConfigDTO config) {
ApiExecutionQueue executionQueue = new ApiExecutionQueue(); ApiExecutionQueue executionQueue = new ApiExecutionQueue();
executionQueue.setId(UUID.randomUUID().toString()); executionQueue.setId(UUID.randomUUID().toString());
executionQueue.setCreateTime(System.currentTimeMillis()); executionQueue.setCreateTime(System.currentTimeMillis());
executionQueue.setPoolId(poolId); executionQueue.setPoolId(poolId);
executionQueue.setFailure(failure); executionQueue.setFailure(config.isOnSampleError());
executionQueue.setReportId(reportId); executionQueue.setReportId(reportId);
executionQueue.setReportType(StringUtils.isNotEmpty(reportType) ? reportType : RunModeConstants.INDEPENDENCE.toString()); executionQueue.setReportType(StringUtils.isNotEmpty(reportType) ? reportType : RunModeConstants.INDEPENDENCE.toString());
executionQueue.setRunMode(runMode); executionQueue.setRunMode(runMode);
@ -76,12 +77,12 @@ public class ApiExecutionQueueService {
if (StringUtils.equalsAnyIgnoreCase(type, ApiRunMode.DEFINITION.name(), ApiRunMode.API_PLAN.name())) { if (StringUtils.equalsAnyIgnoreCase(type, ApiRunMode.DEFINITION.name(), ApiRunMode.API_PLAN.name())) {
final int[] sort = {0}; final int[] sort = {0};
Map<String, ApiDefinitionExecResult> runMap = (Map<String, ApiDefinitionExecResult>) runObj; Map<String, ApiDefinitionExecResult> runMap = (Map<String, ApiDefinitionExecResult>) runObj;
if (envMap == null) { if (config.getEnvMap() == null) {
envMap = new LinkedHashMap<>(); config.setEnvMap(new LinkedHashMap<>());
} }
String envStr = JSON.toJSONString(envMap); String envStr = JSON.toJSONString(config.getEnvMap());
runMap.forEach((k, v) -> { runMap.forEach((k, v) -> {
ApiExecutionQueueDetail queue = detail(v.getId(), k, type, sort[0], executionQueue.getId(), envStr); ApiExecutionQueueDetail queue = detail(v.getId(), k, config.getMode(), sort[0], executionQueue.getId(), envStr);
if (sort[0] == 0) { if (sort[0] == 0) {
resQueue.setQueue(queue); resQueue.setQueue(queue);
} }
@ -93,7 +94,7 @@ public class ApiExecutionQueueService {
Map<String, RunModeDataDTO> runMap = (Map<String, RunModeDataDTO>) runObj; Map<String, RunModeDataDTO> runMap = (Map<String, RunModeDataDTO>) runObj;
final int[] sort = {0}; final int[] sort = {0};
runMap.forEach((k, v) -> { runMap.forEach((k, v) -> {
ApiExecutionQueueDetail queue = detail(k, v.getTestId(), type, sort[0], executionQueue.getId(), JSON.toJSONString(v.getPlanEnvMap())); ApiExecutionQueueDetail queue = detail(k, v.getTestId(), config.getMode(), sort[0], executionQueue.getId(), JSON.toJSONString(v.getPlanEnvMap()));
queue.setSort(sort[0]); queue.setSort(sort[0]);
if (sort[0] == 0) { if (sort[0] == 0) {
resQueue.setQueue(queue); resQueue.setQueue(queue);
@ -124,10 +125,48 @@ public class ApiExecutionQueueService {
return queue; return queue;
} }
private boolean failure(DBTestQueue executionQueue, ResultDTO dto) {
LoggerUtil.info("进入失败停止处理:" + executionQueue.getId());
boolean isError = false;
if (StringUtils.equalsAnyIgnoreCase(dto.getRunMode(), ApiRunMode.SCENARIO.name(),
ApiRunMode.SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(),
ApiRunMode.SCHEDULE_SCENARIO.name(), ApiRunMode.JENKINS_SCENARIO_PLAN.name())) {
ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(executionQueue.getNowReportId());
if (report != null && StringUtils.equalsIgnoreCase(report.getStatus(), "Error")) {
isError = true;
}
} else {
ApiDefinitionExecResult result = apiDefinitionExecResultMapper.selectByPrimaryKey(executionQueue.getNowReportId());
if (result != null && StringUtils.equalsIgnoreCase(result.getStatus(), "Error")) {
isError = true;
}
}
if (isError) {
ApiExecutionQueueDetailExample example = new ApiExecutionQueueDetailExample();
example.createCriteria().andQueueIdEqualTo(dto.getQueueId());
if (StringUtils.isNotEmpty(dto.getTestPlanReportId())) {
CommonBeanFactory.getBean(TestPlanReportService.class).finishedTestPlanReport(dto.getTestPlanReportId(), "Stopped");
}
// 更新未执行的报告状态
List<ApiExecutionQueueDetail> details = executionQueueDetailMapper.selectByExample(example);
List<String> reportIds = details.stream().map(ApiExecutionQueueDetail::getReportId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(reportIds)) {
extApiDefinitionExecResultMapper.update(reportIds);
extApiScenarioReportMapper.update(reportIds);
}
// 清除队列
executionQueueDetailMapper.deleteByExample(example);
queueMapper.deleteByPrimaryKey(executionQueue.getId());
return false;
}
return true;
}
public DBTestQueue edit(String id, String testId) { public DBTestQueue edit(String id, String testId) {
ApiExecutionQueue executionQueue = queueMapper.selectByPrimaryKey(id); ApiExecutionQueue executionQueue = queueMapper.selectByPrimaryKey(id);
DBTestQueue queue = new DBTestQueue();
if (executionQueue != null) { if (executionQueue != null) {
DBTestQueue queue = new DBTestQueue();
BeanUtils.copyBean(queue, executionQueue); BeanUtils.copyBean(queue, executionQueue);
if (executionQueue != null) { if (executionQueue != null) {
ApiExecutionQueueDetailExample example = new ApiExecutionQueueDetailExample(); ApiExecutionQueueDetailExample example = new ApiExecutionQueueDetailExample();
@ -152,50 +191,21 @@ public class ApiExecutionQueueService {
queueMapper.deleteByPrimaryKey(id); queueMapper.deleteByPrimaryKey(id);
} }
} }
return queue;
} }
return null; return queue;
} }
public void queueNext(ResultDTO dto) { public void queueNext(ResultDTO dto) {
DBTestQueue executionQueue = this.edit(dto.getQueueId(), dto.getTestId()); DBTestQueue executionQueue = this.edit(dto.getQueueId(), dto.getTestId());
if (executionQueue != null) { if (executionQueue != null) {
// 串行失败停止
if (executionQueue.getFailure()) { if (executionQueue.getFailure()) {
LoggerUtil.info("进入失败停止处理:" + executionQueue.getId()); boolean isNext = failure(executionQueue, dto);
boolean isError = false; if (!isNext) {
if (StringUtils.equalsAnyIgnoreCase(dto.getRunMode(), ApiRunMode.SCENARIO.name(),
ApiRunMode.SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(),
ApiRunMode.SCHEDULE_SCENARIO.name(), ApiRunMode.JENKINS_SCENARIO_PLAN.name())) {
ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(executionQueue.getNowReportId());
if (report != null && StringUtils.equalsIgnoreCase(report.getStatus(), "Error")) {
isError = true;
}
} else {
ApiDefinitionExecResult result = apiDefinitionExecResultMapper.selectByPrimaryKey(executionQueue.getNowReportId());
if (result != null && StringUtils.equalsIgnoreCase(result.getStatus(), "Error")) {
isError = true;
}
}
if (isError) {
ApiExecutionQueueDetailExample example = new ApiExecutionQueueDetailExample();
example.createCriteria().andQueueIdEqualTo(dto.getQueueId());
if (StringUtils.isNotEmpty(dto.getTestPlanReportId())) {
CommonBeanFactory.getBean(TestPlanReportService.class).finishedTestPlanReport(dto.getTestPlanReportId(), "Stopped");
}
// 更新未执行的报告状态
List<ApiExecutionQueueDetail> details = executionQueueDetailMapper.selectByExample(example);
List<String> reportIds = details.stream().map(ApiExecutionQueueDetail::getReportId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(reportIds)) {
extApiDefinitionExecResultMapper.update(reportIds);
extApiScenarioReportMapper.update(reportIds);
}
// 清除队列
executionQueueDetailMapper.deleteByExample(example);
queueMapper.deleteByPrimaryKey(executionQueue.getId());
return; return;
} }
} }
LoggerUtil.info("开始处理执行队列:" + executionQueue.getId()); LoggerUtil.info("开始处理执行队列:" + executionQueue.getId());
if (executionQueue.getQueue() != null && StringUtils.isNotEmpty(executionQueue.getQueue().getTestId())) { if (executionQueue.getQueue() != null && StringUtils.isNotEmpty(executionQueue.getQueue().getTestId())) {
if (StringUtils.equals(dto.getRunType(), RunModeConstants.SERIAL.toString())) { if (StringUtils.equals(dto.getRunType(), RunModeConstants.SERIAL.toString())) {
@ -220,61 +230,64 @@ public class ApiExecutionQueueService {
} }
} }
public void timeOut() { public void timeOut() {
final int SECOND_MILLIS = 1000; final int SECOND_MILLIS = 1000;
final int MINUTE_MILLIS = 60 * SECOND_MILLIS; final int MINUTE_MILLIS = 60 * SECOND_MILLIS;
// 计算二十分钟前的超时报告 // 计算二十分钟前的超时报告
final long timeBeforeTimeOutStemp = System.currentTimeMillis() - (20 * MINUTE_MILLIS); final long twentyMinutesAgo = System.currentTimeMillis() - (20 * MINUTE_MILLIS);
ApiExecutionQueueDetailExample example = new ApiExecutionQueueDetailExample(); ApiExecutionQueueDetailExample example = new ApiExecutionQueueDetailExample();
example.createCriteria().andCreateTimeLessThan(timeBeforeTimeOutStemp); example.createCriteria().andCreateTimeLessThan(twentyMinutesAgo);
List<ApiExecutionQueueDetail> queueDetails = executionQueueDetailMapper.selectByExample(example); List<ApiExecutionQueueDetail> queueDetails = executionQueueDetailMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(queueDetails)) { queueDetails.forEach(item -> {
queueDetails.forEach(item -> { ApiExecutionQueue queue = queueMapper.selectByPrimaryKey(item.getQueueId());
if (StringUtils.equalsAnyIgnoreCase(item.getType(), ApiRunMode.SCENARIO.name(), ApiRunMode.SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(), ApiRunMode.SCHEDULE_SCENARIO.name(), ApiRunMode.JENKINS_SCENARIO_PLAN.name())) { if (queue != null && StringUtils.equalsAnyIgnoreCase(queue.getRunMode(),
ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(item.getReportId()); ApiRunMode.SCENARIO.name(),
if (report != null ApiRunMode.SCENARIO_PLAN.name(),
&& StringUtils.equalsAnyIgnoreCase(report.getStatus(), TestPlanReportStatus.RUNNING.name()) ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(),
&& report.getUpdateTime() < timeBeforeTimeOutStemp) { ApiRunMode.SCHEDULE_SCENARIO.name(),
//场景报告最后一次更新时间于当前时间相比超过了20分钟也就是20分钟没有步骤执行完成这种情况下做超时处理 ApiRunMode.JENKINS_SCENARIO_PLAN.name())) {
report.setStatus(ScenarioStatus.Timeout.name()); ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(item.getReportId());
apiScenarioReportMapper.updateByPrimaryKeySelective(report); if (report != null && StringUtils.equalsAnyIgnoreCase(report.getStatus(), TestPlanReportStatus.RUNNING.name())
&& report.getUpdateTime() < twentyMinutesAgo) {
report.setStatus(ScenarioStatus.Timeout.name());
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
ResultDTO dto = new ResultDTO(); LoggerUtil.info("超时处理报告:" + report.getId());
dto.setQueueId(item.getQueueId()); ResultDTO dto = new ResultDTO();
dto.setTestId(item.getTestId()); dto.setQueueId(item.getQueueId());
ApiExecutionQueue executionQueue = queueMapper.selectByPrimaryKey(item.getQueueId()); dto.setTestId(item.getTestId());
if (executionQueue != null) { ApiExecutionQueue executionQueue = queueMapper.selectByPrimaryKey(item.getQueueId());
dto.setTestPlanReportId(executionQueue.getReportId()); if (executionQueue != null && StringUtils.equalsIgnoreCase(item.getType(), RunModeConstants.SERIAL.toString())) {
dto.setReportId(executionQueue.getReportId()); LoggerUtil.info("超时处理报告:【" + report.getId() + "】进入下一个执行");
dto.setRunMode(executionQueue.getRunMode()); dto.setTestPlanReportId(executionQueue.getReportId());
dto.setRunType(RunModeConstants.SERIAL.toString()); dto.setReportId(executionQueue.getReportId());
dto.setReportType(executionQueue.getReportType()); dto.setRunMode(executionQueue.getRunMode());
queueNext(dto); dto.setRunType(item.getType());
}else { dto.setReportType(executionQueue.getReportType());
executionQueueDetailMapper.deleteByPrimaryKey(item.getId()); queueNext(dto);
} } else {
}
} else {
ApiDefinitionExecResult result = apiDefinitionExecResultMapper.selectByPrimaryKey(item.getReportId());
if (result != null && StringUtils.equalsAnyIgnoreCase(result.getStatus(), TestPlanReportStatus.RUNNING.name())) {
result.setStatus(ScenarioStatus.Timeout.name());
apiDefinitionExecResultMapper.updateByPrimaryKeySelective(result);
executionQueueDetailMapper.deleteByPrimaryKey(item.getId()); executionQueueDetailMapper.deleteByPrimaryKey(item.getId());
} }
} }
}); } else {
} ApiDefinitionExecResult result = apiDefinitionExecResultMapper.selectByPrimaryKey(item.getReportId());
if (result != null && StringUtils.equalsAnyIgnoreCase(result.getStatus(), TestPlanReportStatus.RUNNING.name())) {
result.setStatus(ScenarioStatus.Timeout.name());
apiDefinitionExecResultMapper.updateByPrimaryKeySelective(result);
executionQueueDetailMapper.deleteByPrimaryKey(item.getId());
}
}
});
ApiExecutionQueueExample queueDetailExample = new ApiExecutionQueueExample(); ApiExecutionQueueExample queueDetailExample = new ApiExecutionQueueExample();
queueDetailExample.createCriteria().andReportTypeEqualTo(RunModeConstants.SET_REPORT.toString()).andCreateTimeLessThan(timeBeforeTimeOutStemp); queueDetailExample.createCriteria().andReportTypeEqualTo(RunModeConstants.SET_REPORT.toString()).andCreateTimeLessThan(twentyMinutesAgo);
List<ApiExecutionQueue> executionQueues = queueMapper.selectByExample(queueDetailExample); List<ApiExecutionQueue> executionQueues = queueMapper.selectByExample(queueDetailExample);
if (CollectionUtils.isNotEmpty(executionQueues)) { if (CollectionUtils.isNotEmpty(executionQueues)) {
executionQueues.forEach(item -> { executionQueues.forEach(item -> {
ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(item.getReportId()); ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(item.getReportId());
if (report != null && StringUtils.equalsAnyIgnoreCase(report.getStatus(), TestPlanReportStatus.RUNNING.name()) if (report != null && StringUtils.equalsAnyIgnoreCase(report.getStatus(), TestPlanReportStatus.RUNNING.name())
&& (report.getUpdateTime() < timeBeforeTimeOutStemp)) { && (report.getUpdateTime() < twentyMinutesAgo)) {
report.setStatus(ScenarioStatus.Timeout.name()); report.setStatus(ScenarioStatus.Timeout.name());
apiScenarioReportMapper.updateByPrimaryKeySelective(report); apiScenarioReportMapper.updateByPrimaryKeySelective(report);
} }

View File

@ -72,7 +72,7 @@ public class ApiJmeterFileService {
} }
HashTree hashTree; HashTree hashTree;
if (StringUtils.equalsAnyIgnoreCase(runMode, ApiRunMode.DEFINITION.name(), ApiRunMode.JENKINS_API_PLAN.name(), ApiRunMode.API_PLAN.name(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.MANUAL_PLAN.name())) { if (StringUtils.equalsAnyIgnoreCase(runMode, ApiRunMode.DEFINITION.name(), ApiRunMode.JENKINS_API_PLAN.name(), ApiRunMode.API_PLAN.name(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.MANUAL_PLAN.name())) {
hashTree = apiScenarioSerialService.generateHashTree(remoteTestId, runMode, envMap); hashTree = apiScenarioSerialService.generateHashTree(remoteTestId, envMap);
} else { } else {
if (scenario == null) { if (scenario == null) {
scenario = apiScenarioMapper.selectByPrimaryKey(remoteTestId); scenario = apiScenarioMapper.selectByPrimaryKey(remoteTestId);