Merge branch 'v1.7' of https://github.com/metersphere/metersphere into v1.7
This commit is contained in:
commit
91e1215d65
|
@ -87,7 +87,7 @@ public class MsScenario extends MsTestElement {
|
||||||
}
|
}
|
||||||
// 场景变量和环境变量
|
// 场景变量和环境变量
|
||||||
tree.add(arguments(config));
|
tree.add(arguments(config));
|
||||||
this.addCsvDataSet(tree, variables);
|
//this.addCsvDataSet(tree, variables);
|
||||||
this.addCounter(tree, variables);
|
this.addCounter(tree, variables);
|
||||||
this.addRandom(tree, variables);
|
this.addRandom(tree, variables);
|
||||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||||
|
|
|
@ -196,6 +196,8 @@ public abstract class MsTestElement {
|
||||||
csvDataSet.setProperty("filename", BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName());
|
csvDataSet.setProperty("filename", BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName());
|
||||||
}
|
}
|
||||||
csvDataSet.setIgnoreFirstLine(false);
|
csvDataSet.setIgnoreFirstLine(false);
|
||||||
|
csvDataSet.setRecycle(true);
|
||||||
|
csvDataSet.setProperty("recycle", true);
|
||||||
csvDataSet.setProperty("delimiter", item.getDelimiter());
|
csvDataSet.setProperty("delimiter", item.getDelimiter());
|
||||||
csvDataSet.setComment(StringUtils.isEmpty(item.getDescription()) ? "" : item.getDescription());
|
csvDataSet.setComment(StringUtils.isEmpty(item.getDescription()) ? "" : item.getDescription());
|
||||||
tree.add(csvDataSet);
|
tree.add(csvDataSet);
|
||||||
|
|
|
@ -171,12 +171,16 @@ public class HistoricalDataUpgradeService {
|
||||||
element = new MsJDBCSampler();
|
element = new MsJDBCSampler();
|
||||||
SqlRequest request1 = (SqlRequest) request;
|
SqlRequest request1 = (SqlRequest) request;
|
||||||
BeanUtils.copyBean(element, request1);
|
BeanUtils.copyBean(element, request1);
|
||||||
|
|
||||||
EnvironmentDTO dto = environmentDTOMap.get(request1.getDataSource());
|
EnvironmentDTO dto = environmentDTOMap.get(request1.getDataSource());
|
||||||
if (dto != null) {
|
if (dto != null) {
|
||||||
((MsJDBCSampler) element).setEnvironmentId(dto.getEnvironmentId());
|
((MsJDBCSampler) element).setEnvironmentId(dto.getEnvironmentId());
|
||||||
((MsJDBCSampler) element).setDataSourceId(dto.getDatabaseConfig().getId());
|
((MsJDBCSampler) element).setDataSourceId(dto.getDatabaseConfig().getId());
|
||||||
((MsJDBCSampler) element).setDataSource(dto.getDatabaseConfig());
|
((MsJDBCSampler) element).setDataSource(dto.getDatabaseConfig());
|
||||||
}
|
}
|
||||||
|
if (CollectionUtils.isEmpty(request1.getVariables())) {
|
||||||
|
((MsJDBCSampler) element).setVariables(new ArrayList<>());
|
||||||
|
}
|
||||||
element.setType("JDBCSampler");
|
element.setType("JDBCSampler");
|
||||||
}
|
}
|
||||||
if (request instanceof TCPRequest) {
|
if (request instanceof TCPRequest) {
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
package io.metersphere.performance.job;
|
|
||||||
|
|
||||||
import com.fit2cloud.quartz.anno.QuartzScheduled;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
|
||||||
import io.metersphere.base.domain.LoadTestReport;
|
|
||||||
import io.metersphere.base.domain.LoadTestReportDetailExample;
|
|
||||||
import io.metersphere.base.domain.LoadTestReportExample;
|
|
||||||
import io.metersphere.base.mapper.LoadTestReportDetailMapper;
|
|
||||||
import io.metersphere.base.mapper.LoadTestReportMapper;
|
|
||||||
import io.metersphere.commons.constants.PerformanceTestStatus;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class LoadTestReportDetailCleanJob {
|
|
||||||
@Resource
|
|
||||||
private LoadTestReportDetailMapper loadTestReportDetailMapper;
|
|
||||||
@Resource
|
|
||||||
private LoadTestReportMapper loadTestReportMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 每天处理一次清理任务
|
|
||||||
*/
|
|
||||||
@QuartzScheduled(cron = "0 0 1 * * ?")
|
|
||||||
public void cleanCompletedTestDetail() {
|
|
||||||
LoadTestReportExample example = new LoadTestReportExample();
|
|
||||||
example.createCriteria().andStatusEqualTo(PerformanceTestStatus.Completed.name());
|
|
||||||
long count = loadTestReportMapper.countByExample(example);
|
|
||||||
for (int i = 0; i < count / 10; i++) {
|
|
||||||
PageHelper.startPage(i, 10);
|
|
||||||
List<LoadTestReport> loadTestReports = loadTestReportMapper.selectByExample(example);
|
|
||||||
loadTestReports.forEach(report -> {
|
|
||||||
// 清理文件
|
|
||||||
LoadTestReportDetailExample example2 = new LoadTestReportDetailExample();
|
|
||||||
example2.createCriteria().andReportIdEqualTo(report.getId());
|
|
||||||
loadTestReportDetailMapper.deleteByExample(example2);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,11 +14,11 @@
|
||||||
<el-form :inline="true">
|
<el-form :inline="true">
|
||||||
<el-form-item :label="$t('load_test.thread_num')">
|
<el-form-item :label="$t('load_test.thread_num')">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
:placeholder="$t('load_test.input_thread_num')"
|
:placeholder="$t('load_test.input_thread_num')"
|
||||||
v-model="threadGroup.threadNumber"
|
v-model="threadGroup.threadNumber"
|
||||||
:min="1"
|
:min="1"
|
||||||
size="mini"/>
|
size="mini"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<br>
|
<br>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
|
@ -31,72 +31,72 @@
|
||||||
<div v-if="threadGroup.threadType === 'DURATION'">
|
<div v-if="threadGroup.threadType === 'DURATION'">
|
||||||
<el-form-item :label="$t('load_test.duration')">
|
<el-form-item :label="$t('load_test.duration')">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
v-model="threadGroup.duration"
|
v-model="threadGroup.duration"
|
||||||
:min="1"
|
:min="1"
|
||||||
@change="calculateChart(threadGroup)"
|
@change="calculateChart(threadGroup)"
|
||||||
size="mini"/>
|
size="mini"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<br>
|
<br>
|
||||||
<el-form-item :label="$t('load_test.rps_limit')">
|
<el-form-item :label="$t('load_test.rps_limit')">
|
||||||
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
|
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
|
||||||
|
|
||||||
<el-input-number
|
<el-input-number
|
||||||
:disabled="true "
|
:disabled="true "
|
||||||
v-model="threadGroup.rpsLimit"
|
v-model="threadGroup.rpsLimit"
|
||||||
@change="calculateChart(threadGroup)"
|
@change="calculateChart(threadGroup)"
|
||||||
:min="1"
|
:min="1"
|
||||||
size="mini"/>
|
size="mini"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<br>
|
<br>
|
||||||
<el-form-item :label="$t('load_test.ramp_up_time_within')">
|
<el-form-item :label="$t('load_test.ramp_up_time_within')">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
:min="1"
|
:min="1"
|
||||||
:max="threadGroup.duration"
|
:max="threadGroup.duration"
|
||||||
v-model="threadGroup.rampUpTime"
|
v-model="threadGroup.rampUpTime"
|
||||||
@change="calculateChart(threadGroup)"
|
@change="calculateChart(threadGroup)"
|
||||||
size="mini"/>
|
size="mini"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('load_test.ramp_up_time_minutes')">
|
<el-form-item :label="$t('load_test.ramp_up_time_minutes')">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
:min="1"
|
:min="1"
|
||||||
:max="Math.min(threadGroup.threadNumber, threadGroup.rampUpTime)"
|
:max="Math.min(threadGroup.threadNumber, threadGroup.rampUpTime)"
|
||||||
v-model="threadGroup.step"
|
v-model="threadGroup.step"
|
||||||
@change="calculateChart(threadGroup)"
|
@change="calculateChart(threadGroup)"
|
||||||
size="mini"/>
|
size="mini"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('load_test.ramp_up_time_times')"/>
|
<el-form-item :label="$t('load_test.ramp_up_time_times')"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="threadGroup.threadType === 'ITERATION'">
|
<div v-if="threadGroup.threadType === 'ITERATION'">
|
||||||
<el-form-item :label="$t('load_test.iterate_num')">
|
<el-form-item :label="$t('load_test.iterate_num')">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
v-model="threadGroup.iterateNum"
|
v-model="threadGroup.iterateNum"
|
||||||
:min="1"
|
:min="1"
|
||||||
@change="calculateChart(threadGroup)"
|
@change="calculateChart(threadGroup)"
|
||||||
size="mini"/>
|
size="mini"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<br>
|
<br>
|
||||||
<el-form-item :label="$t('load_test.rps_limit')">
|
<el-form-item :label="$t('load_test.rps_limit')">
|
||||||
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
|
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
|
||||||
|
|
||||||
<el-input-number
|
<el-input-number
|
||||||
:disabled="true || !threadGroup.rpsLimitEnable"
|
:disabled="true || !threadGroup.rpsLimitEnable"
|
||||||
v-model="threadGroup.rpsLimit"
|
v-model="threadGroup.rpsLimit"
|
||||||
@change="calculateChart(threadGroup)"
|
@change="calculateChart(threadGroup)"
|
||||||
:min="1"
|
:min="1"
|
||||||
size="mini"/>
|
size="mini"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<br>
|
<br>
|
||||||
<el-form-item :label="$t('load_test.ramp_up_time_within')">
|
<el-form-item :label="$t('load_test.ramp_up_time_within')">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
:min="1"
|
:min="1"
|
||||||
v-model="threadGroup.iterateRampUp"
|
v-model="threadGroup.iterateRampUp"
|
||||||
@change="calculateChart(threadGroup)"
|
@change="calculateChart(threadGroup)"
|
||||||
size="mini"/>
|
size="mini"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('load_test.ramp_up_time_seconds')"/>
|
<el-form-item :label="$t('load_test.ramp_up_time_seconds')"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -129,11 +129,11 @@ const ITERATE_RAMP_UP = "iterateRampUpTime";
|
||||||
|
|
||||||
const hexToRgba = function (hex, opacity) {
|
const hexToRgba = function (hex, opacity) {
|
||||||
return 'rgba(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5)) + ','
|
return 'rgba(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5)) + ','
|
||||||
+ parseInt('0x' + hex.slice(5, 7)) + ',' + opacity + ')';
|
+ parseInt('0x' + hex.slice(5, 7)) + ',' + opacity + ')';
|
||||||
}
|
}
|
||||||
const hexToRgb = function (hex) {
|
const hexToRgb = function (hex) {
|
||||||
return 'rgb(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5))
|
return 'rgb(' + parseInt('0x' + hex.slice(1, 3)) + ',' + parseInt('0x' + hex.slice(3, 5))
|
||||||
+ ',' + parseInt('0x' + hex.slice(5, 7)) + ')';
|
+ ',' + parseInt('0x' + hex.slice(5, 7)) + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -469,11 +469,12 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'report.testId': {
|
report: {
|
||||||
handler() {
|
handler() {
|
||||||
this.getJmxContent();
|
this.getJmxContent();
|
||||||
},
|
},
|
||||||
}
|
deep: true
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue