This commit is contained in:
Captain.B 2020-03-29 12:08:38 +08:00
parent a25dd6b02d
commit fd51757c90
4 changed files with 10 additions and 6 deletions

View File

@ -105,15 +105,14 @@ public class KubernetesTestEngine extends AbstractEngine {
public void stop() {
resourceList.forEach(r -> {
try {
EngineContext context = EngineFactory.createContext(loadTest, threadNum);
String configuration = r.getConfiguration();
ClientCredential clientCredential = JSON.parseObject(configuration, ClientCredential.class);
KubernetesProvider provider = new KubernetesProvider(JSON.toJSONString(clientCredential));
provider.confirmNamespace(context.getNamespace());
provider.confirmNamespace(loadTest.getProjectId());
Jmeter jmeter = new Jmeter();
jmeter.setMetadata(new ObjectMeta() {{
setName(context.getTestId());
setNamespace(context.getNamespace());
setName(loadTest.getId());
setNamespace(loadTest.getProjectId());
}});
jmeter.setSpec(new JmeterSpec() {{
setReplicas(1);

View File

@ -166,6 +166,9 @@ public class LoadTestService {
if (loadTest == null) {
MSException.throwException(Translator.get("run_load_test_not_found") + request.getId());
}
if (TestStatus.Running.name().equals(loadTest.getStatus())) {
MSException.throwException(Translator.get("load_test_is_running") + request.getId());
}
LogUtil.info("Load test started " + loadTest.getName());
// engine type (NODE|K8S)

View File

@ -12,5 +12,6 @@
"run_load_test_not_found": "Cannot run test, test not found:",
"run_load_test_file_not_found": "Unable to run test, unable to get test file meta information, test ID:",
"run_load_test_file_content_not_found": "Cannot run test, cannot get test file content, test ID:",
"run_load_test_file_init_error": "Failed to run test, failed to initialize run environment, test ID:"
"run_load_test_file_init_error": "Failed to run test, failed to initialize run environment, test ID:",
"load_test_is_running": "Load test is running, please wait."
}

View File

@ -12,5 +12,6 @@
"run_load_test_not_found": "无法运行测试,未找到测试:",
"run_load_test_file_not_found": "无法运行测试无法获取测试文件元信息测试ID",
"run_load_test_file_content_not_found": "无法运行测试无法获取测试文件内容测试ID",
"run_load_test_file_init_error": "无法运行测试初始化运行环境失败测试ID"
"run_load_test_file_init_error": "无法运行测试初始化运行环境失败测试ID",
"load_test_is_running": "测试正在运行, 请等待"
}