test status

This commit is contained in:
Captain.B 2020-04-01 13:49:29 +08:00
parent 326c1aff4b
commit 1893f43a68
4 changed files with 18 additions and 4 deletions

View File

@ -8,7 +8,9 @@ import java.util.List;
public interface ExtLoadTestReportMapper {
List<ReportDTO> getReportList(@Param("reportRequest")ReportRequest request);
List<ReportDTO> getReportList(@Param("reportRequest") ReportRequest request);
ReportDTO getReportTestAndProInfo(@Param("id") String id);
int appendLine(@Param("testId") String id, @Param("line") String line);
}

View File

@ -11,6 +11,7 @@
AND ltr.name like CONCAT('%', #{reportRequest.name},'%')
</if>
</where>
ORDER BY ltr.update_time DESC
</select>
<select id="getReportTestAndProInfo" resultType="io.metersphere.dto.ReportDTO">
@ -21,4 +22,10 @@
where ltr.id = #{id}
</select>
<update id="appendLine">
UPDATE load_test_report
SET content = concat(content, #{line})
WHERE id = #{testId}
</update>
</mapper>

View File

@ -3,6 +3,7 @@ package io.metersphere.service;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtLoadTestMapper;
import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper;
import io.metersphere.commons.constants.FileType;
import io.metersphere.commons.constants.TestStatus;
import io.metersphere.commons.exception.MSException;
@ -44,6 +45,8 @@ public class LoadTestService {
private FileService fileService;
@Resource
private LoadTestReportMapper loadTestReportMapper;
@Resource
private ExtLoadTestReportMapper extLoadTestReportMapper;
public List<LoadTestDTO> list(QueryTestPlanRequest request) {
return extLoadTestMapper.list(request);
@ -179,7 +182,7 @@ public class LoadTestService {
// 启动测试
engine.start();
// 标记running状态
loadTest.setStatus(TestStatus.Running.name());
loadTest.setStatus(TestStatus.Starting.name());
loadTestMapper.updateByPrimaryKeySelective(loadTest);
LoadTestReport testReport = new LoadTestReport();
@ -190,9 +193,10 @@ public class LoadTestService {
testReport.setName(loadTest.getName());
testReport.setContent(HEADERS);
testReport.setStatus(TestStatus.Starting.name());
loadTestReportMapper.insertSelective(testReport);
// append \n
extLoadTestReportMapper.appendLine(testReport.getId(), "\n");
// todo通过调用stop方法能够停止正在运行的engine但是如果部署了多个backend实例页面发送的停止请求如何定位到具体的engine
}

View File

@ -148,6 +148,7 @@
message: this.$t('load_test.is_running'),
type: 'success'
});
this.$router.push({path: '/performance/report/all'})
})
});
},