This commit is contained in:
chenjianxing 2020-04-02 14:30:17 +08:00
commit d800a15a79
8 changed files with 58 additions and 21 deletions

View File

@ -1,5 +1,6 @@
package io.metersphere;
import io.metersphere.config.JmeterProperties;
import io.metersphere.config.KafkaProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -9,11 +10,12 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
@SpringBootApplication(exclude = {QuartzAutoConfiguration.class})
@ServletComponentScan
@EnableConfigurationProperties(KafkaProperties.class)
@EnableConfigurationProperties({
KafkaProperties.class,
JmeterProperties.class
})
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

View File

@ -0,0 +1,20 @@
package io.metersphere.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = JmeterProperties.JMETER_PREFIX)
public class JmeterProperties {
public static final String JMETER_PREFIX = "jmeter";
private String image = "registry.fit2cloud.com/metersphere/jmeter-master:0.0.3";
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
}

View File

@ -10,6 +10,7 @@ import io.metersphere.commons.constants.ResourcePoolTypeEnum;
import io.metersphere.commons.constants.TestStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.config.JmeterProperties;
import io.metersphere.service.LoadTestService;
import io.metersphere.service.TestResourcePoolService;
import io.metersphere.service.TestResourceService;
@ -20,9 +21,7 @@ import java.util.List;
import java.util.UUID;
public abstract class AbstractEngine implements Engine {
public static final String REGISTRY = "registry.fit2cloud.com/metersphere/";
public static final String JMETER_IMAGE = "jmeter-master:0.0.2";
protected String JMETER_IMAGE;
private Long startTime;
private String reportId;
protected LoadTestWithBLOBs loadTest;
@ -36,6 +35,7 @@ public abstract class AbstractEngine implements Engine {
public AbstractEngine() {
testResourcePoolService = CommonBeanFactory.getBean(TestResourcePoolService.class);
testResourceService = CommonBeanFactory.getBean(TestResourceService.class);
JMETER_IMAGE = CommonBeanFactory.getBean(JmeterProperties.class).getImage();
this.startTime = System.currentTimeMillis();
this.reportId = UUID.randomUUID().toString();
}

View File

@ -80,7 +80,7 @@ public class DockerTestEngine extends AbstractEngine {
testRequest.setSize(1);
testRequest.setTestId(testId);
testRequest.setFileString(content);
testRequest.setImage(REGISTRY + JMETER_IMAGE);
testRequest.setImage(JMETER_IMAGE);
testRequest.setTestData(context.getTestData());
// todo 判断测试状态

View File

@ -87,7 +87,7 @@ public class KubernetesTestEngine extends AbstractEngine {
}});
jmeter.setSpec(new JmeterSpec() {{
setReplicas(1);
setImage(REGISTRY + JMETER_IMAGE);
setImage(JMETER_IMAGE);
}});
LogUtil.info("Load test started. " + context.getTestId());
kubernetesProvider.applyCustomResource(jmeter);
@ -111,7 +111,7 @@ public class KubernetesTestEngine extends AbstractEngine {
}});
jmeter.setSpec(new JmeterSpec() {{
setReplicas(1);
setImage(REGISTRY + JMETER_IMAGE);
setImage(JMETER_IMAGE);
}});
provider.deleteCustomResource(jmeter);
} catch (Exception e) {

View File

@ -8,9 +8,9 @@
<span class="title">{{$t('commons.report')}}</span>
<span class="search">
<el-input type="text" size="small" :placeholder="$t('report.search_by_name')"
prefix-icon="el-icon-search"
maxlength="60"
v-model="condition" @change="search" clearable/>
prefix-icon="el-icon-search"
maxlength="60"
v-model="condition" @change="search" clearable/>
</span>
</el-row>
</div>
@ -19,12 +19,6 @@
<el-table-column
prop="name"
:label="$t('commons.name')"
width="150"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="description"
:label="$t('commons.description')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
@ -47,6 +41,27 @@
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
prop="status"
:label="$t('commons.status')">
<template slot-scope="{row}">
<el-tag size="mini" type="primary" v-if="row.status === 'Starting'">
{{ row.status }}
</el-tag>
<el-tag size="mini" type="success" v-else-if="row.status === 'Running'">
{{ row.status }}
</el-tag>
<el-tooltip placement="top" v-else-if="row.status === 'Error'" effect="light">
<div slot="content">{{row.description}}</div>
<el-tag size="mini" type="danger">
{{ row.status }}
</el-tag>
</el-tooltip>
<el-tag size="mini" type="info" v-else>
{{ row.status }}
</el-tag>
</template>
</el-table-column>
<el-table-column
width="150"
:label="$t('commons.operating')">
@ -145,7 +160,7 @@
});
},
_handleDelete(report) {
this.result = this.$post(this.deletePath + report.id, {},() => {
this.result = this.$post(this.deletePath + report.id, {}, () => {
this.$message({
message: this.$t('commons.delete_success'),
type: 'success'

View File

@ -30,7 +30,7 @@ export default {
'phone': 'Phone',
'role': 'Role',
'personal_info': 'Personal Info',
'status': 'Enable/Disable',
'status': 'Status',
'show_all': 'Show All',
'report': 'Report',
'user': 'User',

View File

@ -30,7 +30,7 @@ export default {
'phone': '电话',
'role': '角色',
'personal_info': '个人信息',
'status': '启用/禁用',
'status': '状态',
'show_all': '显示全部',
'report': '报告',
'user': '用户',