压力配置
This commit is contained in:
parent
25426b299e
commit
2a1ac00ac8
|
@ -6,7 +6,6 @@ import io.metersphere.base.domain.FileMetadata;
|
|||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.controller.request.ProjectRequest;
|
||||
import io.metersphere.controller.request.testplan.*;
|
||||
import io.metersphere.dto.LoadTestDTO;
|
||||
import io.metersphere.service.FileService;
|
||||
|
@ -74,6 +73,11 @@ public class LoadTestController {
|
|||
return loadTestService.getAdvancedConfiguration(testId);
|
||||
}
|
||||
|
||||
@GetMapping("/get-load-config/{testId}")
|
||||
public String getLoadConfiguration(@PathVariable String testId) {
|
||||
return loadTestService.getLoadConfiguration(testId);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public void delete(@RequestBody DeleteTestPlanRequest request) {
|
||||
loadTestService.delete(request);
|
||||
|
|
|
@ -192,4 +192,9 @@ public class LoadTestService {
|
|||
LoadTestWithBLOBs loadTestWithBLOBs = loadTestMapper.selectByPrimaryKey(testId);
|
||||
return Optional.ofNullable(loadTestWithBLOBs).orElse(new LoadTestWithBLOBs()).getAdvancedConfiguration();
|
||||
}
|
||||
|
||||
public String getLoadConfiguration(String testId) {
|
||||
LoadTestWithBLOBs loadTestWithBLOBs = loadTestMapper.selectByPrimaryKey(testId);
|
||||
return Optional.ofNullable(loadTestWithBLOBs).orElse(new LoadTestWithBLOBs()).getLoadConfiguration();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,11 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
const TARGET_LEVEL = "TargetLevel";
|
||||
const RAMP_UP = "RampUp";
|
||||
const STEPS = "Steps";
|
||||
const DURATION = "duration";
|
||||
const RPS_LIMIT = "rpsLimit";
|
||||
|
||||
export default {
|
||||
name: "MsTestPlanPressureConfig",
|
||||
|
@ -96,16 +101,57 @@
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
this.testPlan.loadConfigurationObj = [];
|
||||
this.calculateChart();
|
||||
this.convertProperty();
|
||||
let testId = this.$route.path.split('/')[2];
|
||||
if (testId) {
|
||||
this.getLoadConfig(testId);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
testPlan() {
|
||||
this.convertProperty();
|
||||
'$route'(to) {
|
||||
let testId = to.path.split('/')[2];
|
||||
if (testId) {
|
||||
this.getLoadConfig(testId);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getLoadConfig(testId) {
|
||||
this.$get('/testplan/get-load-config/' + testId, (response) => {
|
||||
if (response.data) {
|
||||
let data = JSON.parse(response.data);
|
||||
|
||||
data.forEach(d => {
|
||||
switch (d.key) {
|
||||
case TARGET_LEVEL:
|
||||
this.threadNumber = d.value;
|
||||
break;
|
||||
case RAMP_UP:
|
||||
this.rampUpTime = d.value;
|
||||
break;
|
||||
case DURATION:
|
||||
this.duration = d.value;
|
||||
break;
|
||||
case STEPS:
|
||||
this.step = d.value;
|
||||
break;
|
||||
case RPS_LIMIT:
|
||||
this.rpsLimit = d.value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
this.threadNumber = this.threadNumber || 10;
|
||||
this.duration = this.duration || 30;
|
||||
this.rampUpTime = this.rampUpTime || 12;
|
||||
this.step = this.step || 3;
|
||||
this.rpsLimit = this.rpsLimit || 10;
|
||||
|
||||
this.calculateChart();
|
||||
}
|
||||
});
|
||||
},
|
||||
calculateChart() {
|
||||
this.orgOptions = {
|
||||
xAxis: {
|
||||
|
@ -142,11 +188,11 @@
|
|||
convertProperty() {
|
||||
/// todo:下面4个属性是jmeter ConcurrencyThreadGroup plugin的属性,这种硬编码不太好吧,在哪能转换这种属性?
|
||||
return [
|
||||
{key: "TargetLevel", value: this.threadNumber},
|
||||
{key: "RampUp", value: this.rampUpTime},
|
||||
{key: "Steps", value: this.step},
|
||||
{key: "duration", value: this.duration},
|
||||
{key: "rpsLimit", value: this.rpsLimit}
|
||||
{key: TARGET_LEVEL, value: this.threadNumber},
|
||||
{key: RAMP_UP, value: this.rampUpTime},
|
||||
{key: STEPS, value: this.step},
|
||||
{key: DURATION, value: this.duration},
|
||||
{key: RPS_LIMIT, value: this.rpsLimit}
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue