feat(接口自动化): 完善K8s执行接口。
This commit is contained in:
parent
19ff4e8d5d
commit
8bb93694bc
|
@ -323,9 +323,7 @@ public class JMeterService {
|
||||||
BaseSystemConfigDTO baseInfo = CommonBeanFactory.getBean(SystemParameterService.class).getBaseInfo();
|
BaseSystemConfigDTO baseInfo = CommonBeanFactory.getBean(SystemParameterService.class).getBaseInfo();
|
||||||
RunRequest runRequest = new RunRequest();
|
RunRequest runRequest = new RunRequest();
|
||||||
runRequest.setTestId(testId);
|
runRequest.setTestId(testId);
|
||||||
if (ApiRunMode.API_PLAN.name().equals(runMode)) {
|
runRequest.setReportId(reportId);
|
||||||
runRequest.setReportId(reportId);
|
|
||||||
}
|
|
||||||
runRequest.setPoolId(resourcePoolId);
|
runRequest.setPoolId(resourcePoolId);
|
||||||
// 占位符
|
// 占位符
|
||||||
String platformUrl = "http://localhost:8081";
|
String platformUrl = "http://localhost:8081";
|
||||||
|
@ -341,8 +339,14 @@ public class JMeterService {
|
||||||
// 如果是K8S调用
|
// 如果是K8S调用
|
||||||
TestResourcePool pool = testResourcePoolMapper.selectByPrimaryKey(resourcePoolId);
|
TestResourcePool pool = testResourcePoolMapper.selectByPrimaryKey(resourcePoolId);
|
||||||
if (pool != null && pool.getApi() && pool.getType().equals(ResourcePoolTypeEnum.K8S.name())) {
|
if (pool != null && pool.getApi() && pool.getType().equals(ResourcePoolTypeEnum.K8S.name())) {
|
||||||
final Engine engine = EngineFactory.createApiEngine(runRequest);
|
try {
|
||||||
engine.start();
|
final Engine engine = EngineFactory.createApiEngine(runRequest);
|
||||||
|
engine.start();
|
||||||
|
} catch (Exception e) {
|
||||||
|
ApiScenarioReportService apiScenarioReportService = CommonBeanFactory.getBean(ApiScenarioReportService.class);
|
||||||
|
apiScenarioReportService.delete(reportId);
|
||||||
|
MSException.throwException(e.getMessage());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
TestResource testResource = resourcePoolCalculation.getPool(resourcePoolId);
|
TestResource testResource = resourcePoolCalculation.getPool(resourcePoolId);
|
||||||
String configuration = testResource.getConfiguration();
|
String configuration = testResource.getConfiguration();
|
||||||
|
|
|
@ -327,7 +327,7 @@ public class ApiScenarioReportService {
|
||||||
*
|
*
|
||||||
* @param reportId
|
* @param reportId
|
||||||
*/
|
*/
|
||||||
private void updateScenarioStatus(String reportId) {
|
public void updateScenarioStatus(String reportId) {
|
||||||
if (StringUtils.isNotEmpty(reportId)) {
|
if (StringUtils.isNotEmpty(reportId)) {
|
||||||
List<String> list = new LinkedList<>();
|
List<String> list = new LinkedList<>();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -94,8 +94,9 @@ public class EngineFactory {
|
||||||
return (Engine) ConstructorUtils.invokeConstructor(kubernetesTestEngineClass, runRequest);
|
return (Engine) ConstructorUtils.invokeConstructor(kubernetesTestEngineClass, runRequest);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
return null;
|
MSException.throwException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EngineContext createContext(LoadTestWithBLOBs loadTest, double[] ratios, String reportId, int resourceIndex) {
|
public static EngineContext createContext(LoadTestWithBLOBs loadTest, double[] ratios, String reportId, int resourceIndex) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit da4c4755072cb1e4f764981f00101e1ea8de62bc
|
Subproject commit acbb458b5ec921754773cfdfc7a5b7f3ffebfaae
|
|
@ -6,8 +6,8 @@
|
||||||
text-color="#fff"
|
text-color="#fff"
|
||||||
active-text-color="#fff">
|
active-text-color="#fff">
|
||||||
<el-menu-item onselectstart="return false">
|
<el-menu-item onselectstart="return false">
|
||||||
<el-tooltip :content="$t('commons.task_center')">
|
<el-tooltip :content="$t('commons.task_center')" effect="light">
|
||||||
<font-awesome-icon class="icon global" :icon="['fas', 'flag']" @click="showTaskCenter"/>
|
<span @click="showTaskCenter"> <font-awesome-icon class="icon global focusing" :icon="['fas', 'flag']"/></span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
|
@ -107,7 +107,7 @@ export default {
|
||||||
close() {
|
close() {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
},
|
},
|
||||||
open(){
|
open() {
|
||||||
this.showTaskCenter();
|
this.showTaskCenter();
|
||||||
},
|
},
|
||||||
getPercentage(status) {
|
getPercentage(status) {
|
||||||
|
|
Loading…
Reference in New Issue