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