fix(性能测试): 修复由于node-controller返回不正确的错误提示

This commit is contained in:
Captain.B 2021-03-12 15:56:09 +08:00
parent 56110bfa5b
commit 03151eaa3e
1 changed files with 12 additions and 6 deletions

View File

@ -103,12 +103,18 @@ public class DockerTestEngine extends AbstractEngine {
startTestRequest.setEnv(env);
String uri = String.format(BASE_URL + "/jmeter/container/start", nodeIp, port);
ResultHolder result = restTemplate.postForObject(uri, startTestRequest, ResultHolder.class);
if (result == null) {
MSException.throwException(Translator.get("start_engine_fail"));
}
if (!result.isSuccess()) {
MSException.throwException(result.getMessage());
try {
ResultHolder result = restTemplate.postForObject(uri, startTestRequest, ResultHolder.class);
if (result == null) {
MSException.throwException(Translator.get("start_engine_fail"));
}
if (!result.isSuccess()) {
MSException.throwException(result.getMessage());
}
} catch (MSException e) {
throw e;
} catch (Exception e) {
MSException.throwException("Please check node-controller status.");
}
}