feat(接口自动化): 完善K8s执行接口。

This commit is contained in:
fit2-zhao 2021-06-17 14:15:25 +08:00 committed by fit2-zhao
parent 19ff4e8d5d
commit 8bb93694bc
5 changed files with 16 additions and 11 deletions

View File

@ -323,9 +323,7 @@ public class JMeterService {
BaseSystemConfigDTO baseInfo = CommonBeanFactory.getBean(SystemParameterService.class).getBaseInfo();
RunRequest runRequest = new RunRequest();
runRequest.setTestId(testId);
if (ApiRunMode.API_PLAN.name().equals(runMode)) {
runRequest.setReportId(reportId);
}
runRequest.setReportId(reportId);
runRequest.setPoolId(resourcePoolId);
// 占位符
String platformUrl = "http://localhost:8081";
@ -341,8 +339,14 @@ public class JMeterService {
// 如果是K8S调用
TestResourcePool pool = testResourcePoolMapper.selectByPrimaryKey(resourcePoolId);
if (pool != null && pool.getApi() && pool.getType().equals(ResourcePoolTypeEnum.K8S.name())) {
final Engine engine = EngineFactory.createApiEngine(runRequest);
engine.start();
try {
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 {
TestResource testResource = resourcePoolCalculation.getPool(resourcePoolId);
String configuration = testResource.getConfiguration();

View File

@ -327,7 +327,7 @@ public class ApiScenarioReportService {
*
* @param reportId
*/
private void updateScenarioStatus(String reportId) {
public void updateScenarioStatus(String reportId) {
if (StringUtils.isNotEmpty(reportId)) {
List<String> list = new LinkedList<>();
try {

View File

@ -94,8 +94,9 @@ public class EngineFactory {
return (Engine) ConstructorUtils.invokeConstructor(kubernetesTestEngineClass, runRequest);
} catch (Exception e) {
LogUtil.error(e);
return null;
MSException.throwException(e.getMessage());
}
return null;
}
public static EngineContext createContext(LoadTestWithBLOBs loadTest, double[] ratios, String reportId, int resourceIndex) {

@ -1 +1 @@
Subproject commit da4c4755072cb1e4f764981f00101e1ea8de62bc
Subproject commit acbb458b5ec921754773cfdfc7a5b7f3ffebfaae

View File

@ -6,8 +6,8 @@
text-color="#fff"
active-text-color="#fff">
<el-menu-item onselectstart="return false">
<el-tooltip :content="$t('commons.task_center')">
<font-awesome-icon class="icon global" :icon="['fas', 'flag']" @click="showTaskCenter"/>
<el-tooltip :content="$t('commons.task_center')" effect="light">
<span @click="showTaskCenter"> <font-awesome-icon class="icon global focusing" :icon="['fas', 'flag']"/></span>
</el-tooltip>
</el-menu-item>
</el-menu>
@ -107,7 +107,7 @@ export default {
close() {
this.visible = false;
},
open(){
open() {
this.showTaskCenter();
},
getPercentage(status) {