fix(性能测试): 修复固定节点或自定义分配用户数时最大并发数不能限制的问题

--bug=1020219 --user=刘瑞斌 [性能测试]github#20103性能测试设置完资源池中压力机的最大并发数,压测执行时,分配策略选固定节点、自定义策略 没限制住单个压力机的最大并发数 https://www.tapd.cn/55049933/s/1309593

Closes #20103
This commit is contained in:
CaptainB 2022-12-01 16:05:36 +08:00 committed by 刘瑞斌
parent f98e79ed09
commit dac615077e
4 changed files with 27 additions and 3 deletions

View File

@ -206,7 +206,8 @@
<div v-if="threadGroup.strategy === 'auto'"></div>
<div v-else-if="threadGroup.strategy === 'specify'">
<el-form-item :label="$t('load_test.specify_resource')">
<el-select v-model="threadGroup.resourceNodeIndex" size="mini">
<el-select v-model="threadGroup.resourceNodeIndex" @change="specifyNodeChange(threadGroup)"
size="mini">
<el-option
v-for="(node, index) in resourceNodes"
:key="node.ip"
@ -224,7 +225,8 @@
<el-table-column prop="ratio" :label="$t('test_track.home.percentage')">
<template v-slot:default="{row}">
<el-input-number size="mini" v-model="row.ratio"
v-if="rampUpTimeVisible"
@change="customNodeChange(threadGroup)"
:min="0" :step=".1" controls-position="right"
:max="1"></el-input-number>
</template>
@ -706,6 +708,8 @@ export default {
}
if (tg.strategy === "custom") {
this.customNodeChange(tg);
let sum = tg.resourceNodes.map(n => n.ratio).reduce((total, curr) => {
total += curr;
return total;
@ -746,8 +750,25 @@ export default {
return [];
}
},
specifyNodeChange(threadGroup) {
this.$set(this, 'maxThreadNumbers', threadGroup.resourceNodes[threadGroup.resourceNodeIndex].maxConcurrency);
if (threadGroup.threadNumber > this.maxThreadNumbers) {
threadGroup.threadNumber = this.maxThreadNumbers;
}
this.calculateTotalChart();
},
customNodeChange(threadGroup) {
threadGroup.resourceNodes.forEach(node => {
if (node.ratio * threadGroup.threadNumber > node.maxConcurrency) {
setTimeout(() => {
this.$warning(this.$t('performance_test.max_current_threads_tips', [node.ip]));
});
node.ratio = (node.maxConcurrency / threadGroup.threadNumber).toFixed(2);
}
});
this.calculateTotalChart();
},
convertProperty() {
/// todo4jmeter ConcurrencyThreadGroup plugin
let result = [];
//

View File

@ -8,6 +8,7 @@ const message = {
test_duration: '{0} hours {1} minutes {2} seconds',
test_duration_tips: 'Execution Time{0} hours {1} minutes {2} seconds',
},
max_current_threads_tips: 'Exceeded the maximum concurrent number of this node {0}',
sync_scenario_no_permission_tips: 'No permission to create the scenario cannot perform synchronization',
}
}

View File

@ -8,6 +8,7 @@ const message = {
test_duration: '{0}时{1}分{2}秒',
test_duration_tips: '执行时长:{0}时{1}分{2}秒',
},
max_current_threads_tips: '超出此节点{0}最大并发数',
sync_scenario_no_permission_tips: '没有创建接口的权限无法执行同步',
}
}

View File

@ -8,6 +8,7 @@ const message = {
test_duration: '{0}時{1}分{2}秒',
test_duration_tips: '執行時長:{0}時{1}分{2}秒',
},
max_current_threads_tips: '超出此節點{0}最大並發數',
sync_scenario_no_permission_tips: '沒有创建接口的權限無法執行同步',
}
}