fix(接口测试): 超时报告处理
This commit is contained in:
parent
19a61665de
commit
94f610181d
|
@ -26,9 +26,9 @@ public class TestPlanReportListenerScheduled {
|
|||
}
|
||||
|
||||
private void listener(String planReportId) {
|
||||
LoggerUtil.info("检查测试计划执行报告:【" + planReportId + "】");
|
||||
if (TestPlanReportExecuteCatch.getTestPlanExecuteInfo(planReportId) != null) {
|
||||
if (!CommonBeanFactory.getBean(ExecThreadPoolExecutor.class).checkPlanReport(planReportId)) {
|
||||
LoggerUtil.info("检查测试计划执行报告:【" + planReportId + "】");
|
||||
CommonBeanFactory.getBean(TestPlanReportService.class).countReport(planReportId);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -11,6 +11,7 @@ import io.metersphere.base.mapper.ApiExecutionQueueMapper;
|
|||
import io.metersphere.base.mapper.ApiScenarioReportMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiExecutionQueueMapper;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.TestPlanReportStatus;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.constants.RunModeConstants;
|
||||
import io.metersphere.dto.ResultDTO;
|
||||
|
@ -179,8 +180,8 @@ public class ApiExecutionQueueService {
|
|||
final int SECOND_MILLIS = 1000;
|
||||
final int MINUTE_MILLIS = 60 * SECOND_MILLIS;
|
||||
long now = System.currentTimeMillis();
|
||||
// 五分钟前的数据
|
||||
now = now - 5 * MINUTE_MILLIS;
|
||||
// 八分钟前的数据
|
||||
now = now - 8 * MINUTE_MILLIS;
|
||||
ApiExecutionQueueDetailExample example = new ApiExecutionQueueDetailExample();
|
||||
example.createCriteria().andCreateTimeLessThan(now);
|
||||
List<ApiExecutionQueueDetail> queueDetails = executionQueueDetailMapper.selectByExample(example);
|
||||
|
@ -189,13 +190,13 @@ public class ApiExecutionQueueService {
|
|||
queueDetails.forEach(item -> {
|
||||
if (StringUtils.equalsAny(item.getType(), 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(item.getReportId());
|
||||
if (report != null) {
|
||||
if (report != null && StringUtils.equalsAny(report.getStatus(), TestPlanReportStatus.RUNNING.name())) {
|
||||
report.setStatus("timeout");
|
||||
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||
}
|
||||
} else {
|
||||
ApiDefinitionExecResult result = apiDefinitionExecResultMapper.selectByPrimaryKey(item.getReportId());
|
||||
if (result != null) {
|
||||
if (result != null && StringUtils.equalsAny(result.getStatus(), TestPlanReportStatus.RUNNING.name())) {
|
||||
result.setStatus("timeout");
|
||||
apiDefinitionExecResultMapper.updateByPrimaryKeySelective(result);
|
||||
}
|
||||
|
@ -210,7 +211,7 @@ public class ApiExecutionQueueService {
|
|||
if (CollectionUtils.isNotEmpty(executionQueues)) {
|
||||
executionQueues.forEach(item -> {
|
||||
ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(item.getReportId());
|
||||
if (report != null) {
|
||||
if (report != null && StringUtils.equalsAny(report.getStatus(), TestPlanReportStatus.RUNNING.name())) {
|
||||
report.setStatus("timeout");
|
||||
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,6 @@ VALUES (UUID(), 'project_app_manager', 'PROJECT_APP_MANAGER:READ+EDIT', 'PROJECT
|
|||
CREATE TABLE IF NOT EXISTS `api_execution_queue`
|
||||
(
|
||||
`id` varchar(50) NOT NULL COMMENT 'ID',
|
||||
`test_queue` LONGTEXT COMMENT '执行资源Id队列fifo',
|
||||
`report_id` varchar(100) COMMENT '集合报告/测试计划报告',
|
||||
`report_type` varchar(100) COMMENT '报告类型/计划报告/单独报告',
|
||||
`run_mode` varchar(100) COMMENT '执行模式/scenario/api/test_paln_api/test_pan_scenario',
|
||||
|
@ -77,17 +76,18 @@ CREATE TABLE IF NOT EXISTS `api_execution_queue`
|
|||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `api_execution_queue_detail`
|
||||
(
|
||||
`id` varchar(50) NOT NULL COMMENT 'ID',
|
||||
`queue_id` LONGTEXT COMMENT '队列id',
|
||||
`queue_id` varchar(100) COMMENT '队列id',
|
||||
`sort` int COMMENT '排序',
|
||||
`report_id` varchar(100) COMMENT '报告id',
|
||||
`test_id` varchar(100) COMMENT '资源id',
|
||||
`evn_map` varchar(100) COMMENT '环境',
|
||||
`evn_map` LONGTEXT COMMENT '环境',
|
||||
`type` varchar(100) DEFAULT NULL COMMENT '资源类型',
|
||||
create_time bigint(13) NULL COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
|
||||
|
||||
ALTER TABLE load_test
|
||||
MODIFY name VARCHAR(255) NOT NULL COMMENT 'Test name';
|
Loading…
Reference in New Issue