fix(性能测试): 线程数不能小于资源池节点数

This commit is contained in:
Captain.B 2020-11-24 13:28:55 +08:00
parent b013b8b790
commit 7be21db324
4 changed files with 18 additions and 9 deletions

View File

@ -53,13 +53,13 @@ public class TestResourcePoolController {
@GetMapping("list/all/valid")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public List<TestResourcePool> listValidResourcePools() {
public List<TestResourcePoolDTO> listValidResourcePools() {
return testResourcePoolService.listValidResourcePools();
}
@GetMapping("list/quota/valid")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public List<TestResourcePool> listValidQuotaResourcePools() {
public List<TestResourcePoolDTO> listValidQuotaResourcePools() {
return testResourcePoolService.listValidQuotaResourcePools();
}

View File

@ -7,4 +7,5 @@ import lombok.Setter;
@Setter
public class QueryResourcePoolRequest {
private String name;
private String status;
}

View File

@ -145,6 +145,9 @@ public class TestResourcePoolService {
if (StringUtils.isNotBlank(request.getName())) {
criteria.andNameLike(StringUtils.wrapIfMissing(request.getName(), "%"));
}
if (StringUtils.isNotBlank(request.getStatus())) {
criteria.andStatusEqualTo(request.getStatus());
}
example.setOrderByClause("update_time desc");
List<TestResourcePool> testResourcePools = testResourcePoolMapper.selectByExample(example);
List<TestResourcePoolDTO> testResourcePoolDTOS = new ArrayList<>();
@ -232,7 +235,7 @@ public class TestResourcePoolService {
return testResourcePoolMapper.selectByPrimaryKey(resourcePoolId);
}
public List<TestResourcePool> listValidResourcePools() {
public List<TestResourcePoolDTO> listValidResourcePools() {
QueryResourcePoolRequest request = new QueryResourcePoolRequest();
List<TestResourcePoolDTO> testResourcePools = listResourcePools(request);
// 重新校验 pool
@ -249,16 +252,15 @@ public class TestResourcePoolService {
testResourcePoolMapper.updateByPrimaryKeySelective(pool);
}
}
TestResourcePoolExample example = new TestResourcePoolExample();
example.createCriteria().andStatusEqualTo(ResourceStatusEnum.VALID.name());
return testResourcePoolMapper.selectByExample(example);
request.setStatus(VALID.name());
return listResourcePools(request);
}
public List<TestResourcePool> listValidQuotaResourcePools() {
public List<TestResourcePoolDTO> listValidQuotaResourcePools() {
return filterQuota(listValidResourcePools());
}
private List<TestResourcePool> filterQuota(List<TestResourcePool> list) {
private List<TestResourcePoolDTO> filterQuota(List<TestResourcePoolDTO> list) {
QuotaService quotaService = CommonBeanFactory.getBean(QuotaService.class);
if (quotaService != null) {
Set<String> pools = quotaService.getQuotaResourcePools();

View File

@ -30,7 +30,7 @@
:placeholder="$t('load_test.input_thread_num')"
v-model="threadGroup.threadNumber"
@change="calculateChart(threadGroup)"
:min="1"
:min="resourcePoolResourceLength"
size="mini"/>
</el-form-item>
<br>
@ -141,6 +141,7 @@ export default {
activeNames: ["0"],
threadGroups: [],
serializeThreadgroups: false,
resourcePoolResourceLength: 1
}
},
mounted() {
@ -368,6 +369,11 @@ export default {
if (handler.rampUpTime < handler.step) {
handler.step = handler.rampUpTime;
}
// 线
let resourcePool = this.resourcePools.filter(v => v.id === this.resourcePool)[0];
if (resourcePool) {
this.resourcePoolResourceLength = resourcePool.resources.length;
}
handler.options = {
xAxis: {
type: 'category',