mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-04 21:19:52 +08:00
配置资源池
This commit is contained in:
parent
ca66c782d8
commit
8652b0566d
@ -39,4 +39,13 @@ public class TestResourcePoolController {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, testResourcePoolService.listResourcePools(request));
|
||||
}
|
||||
|
||||
@GetMapping("list/all")
|
||||
public List<TestResourcePool> listResourcePools() {
|
||||
PageHelper.startPage(1, 10000, true);
|
||||
QueryResourcePoolRequest request = new QueryResourcePoolRequest();
|
||||
return testResourcePoolService.listResourcePools(request);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import io.fabric8.kubernetes.api.model.ConfigMap;
|
||||
import io.fabric8.kubernetes.api.model.ObjectMeta;
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.engine.Engine;
|
||||
import io.metersphere.engine.EngineContext;
|
||||
@ -11,17 +12,21 @@ import io.metersphere.engine.kubernetes.crds.jmeter.Jmeter;
|
||||
import io.metersphere.engine.kubernetes.crds.jmeter.JmeterSpec;
|
||||
import io.metersphere.engine.kubernetes.provider.ClientCredential;
|
||||
import io.metersphere.engine.kubernetes.provider.KubernetesProvider;
|
||||
import io.metersphere.service.TestResourcePoolService;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class KubernetesTestEngine implements Engine {
|
||||
private EngineContext context;
|
||||
private TestResourcePoolService testResourcePoolService;
|
||||
|
||||
@Override
|
||||
public boolean init(EngineContext context) {
|
||||
// todo 初始化操作
|
||||
this.context = context;
|
||||
this.testResourcePoolService = CommonBeanFactory.getBean(TestResourcePoolService.class);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -207,6 +207,10 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.$refs.pressureConfig.validConfig()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.$refs.advancedConfig.validConfig()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -73,6 +73,21 @@
|
||||
<div>{{$t('load_test.ramp_up_time_times')}}</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :inline="true" class="input-bottom-border">
|
||||
<el-form-item>
|
||||
<div>{{$t('load_test.select_resource_pool')}}</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="resourcePool" size="mini">
|
||||
<el-option
|
||||
v-for="item in resourcePools"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<chart class="chart-container" ref="chart1" :options="orgOptions" :autoresize="true"></chart>
|
||||
@ -89,6 +104,7 @@
|
||||
const STEPS = "Steps";
|
||||
const DURATION = "duration";
|
||||
const RPS_LIMIT = "rpsLimit";
|
||||
const RESOURCE_POOL = "resourcePoolId";
|
||||
|
||||
export default {
|
||||
name: "PerformancePressureConfig",
|
||||
@ -101,6 +117,8 @@
|
||||
step: 10,
|
||||
rpsLimit: 10,
|
||||
orgOptions: {},
|
||||
resourcePool: null,
|
||||
resourcePools: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -110,6 +128,8 @@
|
||||
} else {
|
||||
this.calculateChart();
|
||||
}
|
||||
|
||||
this.getResourcePools();
|
||||
},
|
||||
watch: {
|
||||
'$route'(to, from) {
|
||||
@ -125,11 +145,16 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getResourcePools() {
|
||||
this.$get('/testresourcepool/list/all', response => {
|
||||
this.resourcePools = response.data;
|
||||
})
|
||||
},
|
||||
getLoadConfig(testId) {
|
||||
if (testId) {
|
||||
|
||||
this.$get('/testplan/get-load-config/' + testId, (response) => {
|
||||
if (response.data && response.data != "") {
|
||||
if (response.data) {
|
||||
let data = JSON.parse(response.data);
|
||||
|
||||
data.forEach(d => {
|
||||
@ -149,6 +174,9 @@
|
||||
case RPS_LIMIT:
|
||||
this.rpsLimit = d.value;
|
||||
break;
|
||||
case RESOURCE_POOL:
|
||||
this.resourcePool = d.value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -252,6 +280,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
validConfig() {
|
||||
if (!this.resourcePool) {
|
||||
this.$message({
|
||||
message: this.$t('load_test.resource_pool_is_null'),
|
||||
type: 'warning'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
convertProperty() {
|
||||
/// todo:下面4个属性是jmeter ConcurrencyThreadGroup plugin的属性,这种硬编码不太好吧,在哪能转换这种属性?
|
||||
return [
|
||||
@ -259,7 +298,8 @@
|
||||
{key: RAMP_UP, value: this.rampUpTime},
|
||||
{key: STEPS, value: this.step},
|
||||
{key: DURATION, value: this.duration},
|
||||
{key: RPS_LIMIT, value: this.rpsLimit}
|
||||
{key: RPS_LIMIT, value: this.rpsLimit},
|
||||
{key: RESOURCE_POOL, value: this.resourcePool},
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -158,6 +158,8 @@ export default {
|
||||
'custom_http_code': 'Custom HTTP response success status code',
|
||||
'separated_by_commas': 'Separated by commas',
|
||||
'create': 'Create Test',
|
||||
'select_resource_pool': 'Please Select Resource Pool',
|
||||
'resource_pool_is_null': 'Resource Pool is empty',
|
||||
},
|
||||
fuc_test: {
|
||||
'select_resource_pool': 'Please select resource pool'
|
||||
|
@ -158,6 +158,8 @@ export default {
|
||||
'custom_http_code': '自定义 HTTP 响应成功状态码',
|
||||
'separated_by_commas': '按逗号分隔',
|
||||
'create': '创建测试',
|
||||
'select_resource_pool': '请选择资源池',
|
||||
'resource_pool_is_null': '资源池为空',
|
||||
},
|
||||
fuc_test: {
|
||||
'select_resource_pool': '请选择资源池'
|
||||
|
Loading…
Reference in New Issue
Block a user