run test
This commit is contained in:
parent
a25dd6b02d
commit
fd51757c90
|
@ -105,15 +105,14 @@ public class KubernetesTestEngine extends AbstractEngine {
|
||||||
public void stop() {
|
public void stop() {
|
||||||
resourceList.forEach(r -> {
|
resourceList.forEach(r -> {
|
||||||
try {
|
try {
|
||||||
EngineContext context = EngineFactory.createContext(loadTest, threadNum);
|
|
||||||
String configuration = r.getConfiguration();
|
String configuration = r.getConfiguration();
|
||||||
ClientCredential clientCredential = JSON.parseObject(configuration, ClientCredential.class);
|
ClientCredential clientCredential = JSON.parseObject(configuration, ClientCredential.class);
|
||||||
KubernetesProvider provider = new KubernetesProvider(JSON.toJSONString(clientCredential));
|
KubernetesProvider provider = new KubernetesProvider(JSON.toJSONString(clientCredential));
|
||||||
provider.confirmNamespace(context.getNamespace());
|
provider.confirmNamespace(loadTest.getProjectId());
|
||||||
Jmeter jmeter = new Jmeter();
|
Jmeter jmeter = new Jmeter();
|
||||||
jmeter.setMetadata(new ObjectMeta() {{
|
jmeter.setMetadata(new ObjectMeta() {{
|
||||||
setName(context.getTestId());
|
setName(loadTest.getId());
|
||||||
setNamespace(context.getNamespace());
|
setNamespace(loadTest.getProjectId());
|
||||||
}});
|
}});
|
||||||
jmeter.setSpec(new JmeterSpec() {{
|
jmeter.setSpec(new JmeterSpec() {{
|
||||||
setReplicas(1);
|
setReplicas(1);
|
||||||
|
|
|
@ -166,6 +166,9 @@ public class LoadTestService {
|
||||||
if (loadTest == null) {
|
if (loadTest == null) {
|
||||||
MSException.throwException(Translator.get("run_load_test_not_found") + request.getId());
|
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());
|
LogUtil.info("Load test started " + loadTest.getName());
|
||||||
// engine type (NODE|K8S)
|
// engine type (NODE|K8S)
|
||||||
|
|
|
@ -12,5 +12,6 @@
|
||||||
"run_load_test_not_found": "Cannot run test, test not found:",
|
"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_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_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."
|
||||||
}
|
}
|
|
@ -12,5 +12,6 @@
|
||||||
"run_load_test_not_found": "无法运行测试,未找到测试:",
|
"run_load_test_not_found": "无法运行测试,未找到测试:",
|
||||||
"run_load_test_file_not_found": "无法运行测试,无法获取测试文件元信息,测试ID:",
|
"run_load_test_file_not_found": "无法运行测试,无法获取测试文件元信息,测试ID:",
|
||||||
"run_load_test_file_content_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": "测试正在运行, 请等待"
|
||||||
}
|
}
|
Loading…
Reference in New Issue