refactor: 启动失败清理任务

This commit is contained in:
Captain.B 2020-10-29 15:04:48 +08:00
parent 8300285c8b
commit 4a855be014
2 changed files with 3 additions and 3 deletions

View File

@ -32,7 +32,6 @@ public class DockerTestEngine extends AbstractEngine {
super.init(loadTest);
this.restTemplate = (RestTemplate) CommonBeanFactory.getBean("restTemplate");
this.restTemplateWithTimeOut = (RestTemplate) CommonBeanFactory.getBean("restTemplateWithTimeOut");
// todo 初始化操作
}
@Override
@ -60,7 +59,6 @@ public class DockerTestEngine extends AbstractEngine {
}
private void runTest(TestResource resource, long realThreadNum, int resourceIndex) {
// todo 运行测试
EngineContext context = null;
try {
context = EngineFactory.createContext(loadTest, resource.getId(), realThreadNum, this.getStartTime(), this.getReportId(), resourceIndex);
@ -99,7 +97,6 @@ public class DockerTestEngine extends AbstractEngine {
@Override
public void stop() {
// TODO 停止运行测试
String testId = loadTest.getId();
this.resourceList.forEach(r -> {
NodeDTO node = JSON.parseObject(r.getConfiguration(), NodeDTO.class);

View File

@ -300,6 +300,9 @@ public class PerformanceTestService {
reportResult.setReportValue("Ready"); // 初始化一个 result_status, 这个值用在data-streaming中
loadTestReportResultMapper.insertSelective(reportResult);
} catch (MSException e) {
// 启动失败之后清理任务
engine.stop();
LogUtil.error(e);
loadTest.setStatus(PerformanceTestStatus.Error.name());
loadTest.setDescription(e.getMessage());