refactor: 资源池增加使用范围:接口测试,性能测试

This commit is contained in:
Captain.B 2021-06-08 15:28:01 +08:00 committed by 刘瑞斌
parent aa0dbb0a3c
commit 480771ee62
13 changed files with 210 additions and 19 deletions

View File

@ -1,9 +1,9 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
import lombok.Data;
@Data
public class TestResourcePool implements Serializable {
private String id;
@ -28,5 +28,9 @@ public class TestResourcePool implements Serializable {
private String createUser;
private Boolean api;
private Boolean performance;
private static final long serialVersionUID = 1L;
}

View File

@ -853,6 +853,126 @@ public class TestResourcePoolExample {
addCriterion("create_user not between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andApiIsNull() {
addCriterion("api is null");
return (Criteria) this;
}
public Criteria andApiIsNotNull() {
addCriterion("api is not null");
return (Criteria) this;
}
public Criteria andApiEqualTo(Boolean value) {
addCriterion("api =", value, "api");
return (Criteria) this;
}
public Criteria andApiNotEqualTo(Boolean value) {
addCriterion("api <>", value, "api");
return (Criteria) this;
}
public Criteria andApiGreaterThan(Boolean value) {
addCriterion("api >", value, "api");
return (Criteria) this;
}
public Criteria andApiGreaterThanOrEqualTo(Boolean value) {
addCriterion("api >=", value, "api");
return (Criteria) this;
}
public Criteria andApiLessThan(Boolean value) {
addCriterion("api <", value, "api");
return (Criteria) this;
}
public Criteria andApiLessThanOrEqualTo(Boolean value) {
addCriterion("api <=", value, "api");
return (Criteria) this;
}
public Criteria andApiIn(List<Boolean> values) {
addCriterion("api in", values, "api");
return (Criteria) this;
}
public Criteria andApiNotIn(List<Boolean> values) {
addCriterion("api not in", values, "api");
return (Criteria) this;
}
public Criteria andApiBetween(Boolean value1, Boolean value2) {
addCriterion("api between", value1, value2, "api");
return (Criteria) this;
}
public Criteria andApiNotBetween(Boolean value1, Boolean value2) {
addCriterion("api not between", value1, value2, "api");
return (Criteria) this;
}
public Criteria andPerformanceIsNull() {
addCriterion("performance is null");
return (Criteria) this;
}
public Criteria andPerformanceIsNotNull() {
addCriterion("performance is not null");
return (Criteria) this;
}
public Criteria andPerformanceEqualTo(Boolean value) {
addCriterion("performance =", value, "performance");
return (Criteria) this;
}
public Criteria andPerformanceNotEqualTo(Boolean value) {
addCriterion("performance <>", value, "performance");
return (Criteria) this;
}
public Criteria andPerformanceGreaterThan(Boolean value) {
addCriterion("performance >", value, "performance");
return (Criteria) this;
}
public Criteria andPerformanceGreaterThanOrEqualTo(Boolean value) {
addCriterion("performance >=", value, "performance");
return (Criteria) this;
}
public Criteria andPerformanceLessThan(Boolean value) {
addCriterion("performance <", value, "performance");
return (Criteria) this;
}
public Criteria andPerformanceLessThanOrEqualTo(Boolean value) {
addCriterion("performance <=", value, "performance");
return (Criteria) this;
}
public Criteria andPerformanceIn(List<Boolean> values) {
addCriterion("performance in", values, "performance");
return (Criteria) this;
}
public Criteria andPerformanceNotIn(List<Boolean> values) {
addCriterion("performance not in", values, "performance");
return (Criteria) this;
}
public Criteria andPerformanceBetween(Boolean value1, Boolean value2) {
addCriterion("performance between", value1, value2, "performance");
return (Criteria) this;
}
public Criteria andPerformanceNotBetween(Boolean value1, Boolean value2) {
addCriterion("performance not between", value1, value2, "performance");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -13,6 +13,8 @@
<result column="heap" jdbcType="VARCHAR" property="heap" />
<result column="gc_algo" jdbcType="VARCHAR" property="gcAlgo" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="api" jdbcType="BIT" property="api" />
<result column="performance" jdbcType="BIT" property="performance" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -74,7 +76,7 @@
</sql>
<sql id="Base_Column_List">
id, `name`, `type`, description, `status`, create_time, update_time, image, `heap`,
gc_algo, create_user
gc_algo, create_user, api, performance
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestResourcePoolExample" resultMap="BaseResultMap">
select
@ -110,11 +112,13 @@
insert into test_resource_pool (id, `name`, `type`,
description, `status`, create_time,
update_time, image, `heap`,
gc_algo, create_user)
gc_algo, create_user, api,
performance)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{image,jdbcType=VARCHAR}, #{heap,jdbcType=VARCHAR},
#{gcAlgo,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR})
#{gcAlgo,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{api,jdbcType=BIT},
#{performance,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestResourcePool">
insert into test_resource_pool
@ -152,6 +156,12 @@
<if test="createUser != null">
create_user,
</if>
<if test="api != null">
api,
</if>
<if test="performance != null">
performance,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -187,6 +197,12 @@
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="api != null">
#{api,jdbcType=BIT},
</if>
<if test="performance != null">
#{performance,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestResourcePoolExample" resultType="java.lang.Long">
@ -231,6 +247,12 @@
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.api != null">
api = #{record.api,jdbcType=BIT},
</if>
<if test="record.performance != null">
performance = #{record.performance,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -248,7 +270,9 @@
image = #{record.image,jdbcType=VARCHAR},
`heap` = #{record.heap,jdbcType=VARCHAR},
gc_algo = #{record.gcAlgo,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR}
create_user = #{record.createUser,jdbcType=VARCHAR},
api = #{record.api,jdbcType=BIT},
performance = #{record.performance,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -286,6 +310,12 @@
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="api != null">
api = #{api,jdbcType=BIT},
</if>
<if test="performance != null">
performance = #{performance,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -300,7 +330,9 @@
image = #{image,jdbcType=VARCHAR},
`heap` = #{heap,jdbcType=VARCHAR},
gc_algo = #{gcAlgo,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR}
create_user = #{createUser,jdbcType=VARCHAR},
api = #{api,jdbcType=BIT},
performance = #{performance,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

@ -1 +1 @@
Subproject commit 80165a0457ca9678bf54dd1541e8c35a3e154019
Subproject commit d11666333d38e3204e98e916802c47ddc331abd0

View File

@ -0,0 +1,16 @@
-- test resource pool
ALTER TABLE test_resource_pool
ADD api TINYINT(1) NULL;
ALTER TABLE test_resource_pool
ADD performance TINYINT(1) NULL;
UPDATE test_resource_pool
SET api = TRUE,
performance = TRUE
WHERE type = 'NODE';
UPDATE test_resource_pool
SET api = FALSE,
performance = TRUE
WHERE type = 'K8S';

View File

@ -33,6 +33,7 @@
v-for="item in resourcePools"
:key="item.id"
:label="item.name"
:disabled="!item.api"
:value="item.id">
</el-option>
</el-select>
@ -134,7 +135,7 @@ export default {
},
getResourcePools() {
this.result = this.$get('/testresourcepool/list/quota/valid', response => {
this.resourcePools = response.data.filter(p => p.type === 'NODE');
this.resourcePools = response.data;
});
},
},

View File

@ -9,6 +9,7 @@
v-for="item in resourcePools"
:key="item.id"
:label="item.name"
:disabled="!item.performance"
:value="item.id">
</el-option>
</el-select>

View File

@ -2,7 +2,8 @@
<div>
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :create-permission="['SYSTEM_TEST_POOL:READ+CREATE']" :condition.sync="condition" @search="search" @create="create"
<ms-table-header :create-permission="['SYSTEM_TEST_POOL:READ+CREATE']" :condition.sync="condition"
@search="search" @create="create"
:create-tip="$t('test_resource_pool.create_resource_pool')"
:title="$t('commons.test_resource_pool')"/>
</template>
@ -70,6 +71,10 @@
<el-form-item :label="$t('commons.image')" prop="image">
<el-input v-model="form.image"/>
</el-form-item>
<el-form-item :label="$t('test_resource_pool.usage')" prop="image">
<el-checkbox :label="$t('commons.api')" v-model="form.api"></el-checkbox>
<el-checkbox :label="$t('commons.performance')" v-model="form.performance"></el-checkbox>
</el-form-item>
<el-form-item label="JMeter HEAP" prop="HEAP">
<el-input v-model="form.heap" placeholder="-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m"/>
</el-form-item>
@ -109,6 +114,13 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="API Image">
<el-input v-model="item.apiImage" type="text"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item :label="$t('test_resource_pool.max_threads')"
@ -208,7 +220,7 @@ export default {
currentPage: 1,
pageSize: 10,
total: 0,
form: {},
form: {performance: true, api: true},
screenHeight: 'calc(100vh - 255px)',
requiredRules: [{required: true, message: this.$t('test_resource_pool.fill_the_data'), trigger: 'blur'}],
rule: {
@ -412,7 +424,7 @@ export default {
});
},
closeFunc() {
this.form = {};
this.form = {performance: true, api: true};
this.dialogVisible = false;
removeGoBackListener(this.closeFunc);
},
@ -441,7 +453,7 @@ export default {
} else {
this.updatePoolStatus(row);
}
})
});
}
},
checkHaveTestUsePool(row) {
@ -449,7 +461,7 @@ export default {
this.$get('/testresourcepool/check/use/' + row.id, result => {
this.updatePool = result.data;
resolve();
})
});
});
},
updatePoolStatus(row) {

View File

@ -52,6 +52,7 @@
v-for="item in resourcePools"
:key="item.id"
:label="item.name"
:disabled="!item.api"
:value="item.id">
</el-option>
</el-select>
@ -112,7 +113,7 @@ export default {
},
getResourcePools() {
this.result = this.$get('/testresourcepool/list/quota/valid', response => {
this.resourcePools = response.data.filter(p => p.type === 'NODE');
this.resourcePools = response.data;
});
},
},

View File

@ -70,6 +70,7 @@
v-for="item in resourcePools"
:key="item.id"
:label="item.name"
:disabled="!item.api"
:value="item.id">
</el-option>
</el-select>
@ -364,7 +365,7 @@ export default {
},
getResourcePools() {
this.result = this.$get('/testresourcepool/list/quota/valid', response => {
this.resourcePools = response.data.filter(p => p.type === 'NODE');
this.resourcePools = response.data;
});
},
},

View File

@ -1645,7 +1645,8 @@ export default {
status_change_failed: 'Failed to change the status, resource pool is invalid!',
check_in: 'Check in',
node_selector_invalid: 'nodeSelector must be JSON',
pod_thread_limit: 'Maximum number of threads per POD'
pod_thread_limit: 'Maximum number of threads per POD',
usage: 'Usage',
},
system_parameter_setting: {
mailbox_service_settings: 'Mailbox Settings',

View File

@ -1653,7 +1653,8 @@ export default {
status_change_failed: '状态修改失败, 校验不通过!',
check_in: '校验中',
node_selector_invalid: 'nodeSelector 必须是有效的JSON',
pod_thread_limit: '单POD最大线程数'
pod_thread_limit: '单POD最大线程数',
usage: '用途',
},
system_parameter_setting: {
mailbox_service_settings: '邮件设置',

View File

@ -1653,7 +1653,8 @@ export default {
status_change_failed: '狀態修改失敗, 校驗不通過!',
check_in: '校驗中',
node_selector_invalid: 'nodeSelector 必須是有效的JSON',
pod_thread_limit: '單POD最大線程數'
pod_thread_limit: '單POD最大線程數',
usage: '用途',
},
system_parameter_setting: {
mailbox_service_settings: '郵件設置',