Merge branch 'v1.4'

This commit is contained in:
chenjianxing 2020-11-03 17:34:13 +08:00
commit db65773cb0
4 changed files with 36 additions and 28 deletions

View File

@ -1,2 +1,2 @@
alter table message_task
add create_time bigint(13) null;
ALTER TABLE message_task
ADD create_time bigint(13) DEFAULT 0;

View File

@ -18,7 +18,7 @@
export default {
name: "MsApiRequestForm",
components: {MsApiSqlRequestForm, MsRequestResultTail, MsScenarioResults, MsApiDubboRequestForm, MsApiHttpRequestForm},
components: {MsApiSqlRequestForm, MsRequestResultTail, MsScenarioResults, MsApiDubboRequestForm, MsApiHttpRequestForm, MsApiTcpRequestForm},
props: {
scenario: Scenario,
request: Request,

View File

@ -1020,7 +1020,8 @@ class JMXHttpRequest {
this.domain = environment.config.httpConfig.domain;
this.port = environment.config.httpConfig.port;
this.protocol = environment.config.httpConfig.protocol;
let envPath = environment.config.httpConfig.protocol + "://" + environment.config.httpConfig.socket;
let url = new URL(environment.config.httpConfig.protocol + "://" + environment.config.httpConfig.socket);
let envPath = url.pathname === '/' ? '' : url.pathname;
this.path = this.getPostQueryParameters(request, decodeURIComponent(envPath + (request.path ? request.path : '')));
}
this.connectTimeout = request.connectTimeout;
@ -1158,17 +1159,18 @@ class JMXGenerator {
sampler = new DubboSample(request.name || "", new JMXDubboRequest(request, scenario.dubboConfig));
} else if (request instanceof HttpRequest) {
sampler = new HTTPSamplerProxy(request.name || "", new JMXHttpRequest(request, scenario.environment));
this.addRequestHeader(sampler, request);
this.addRequestHeader(sampler, request, scenario);
this.addRequestArguments(sampler, request);
this.addRequestBody(sampler, request, testId);
} else if (request instanceof SqlRequest) {
request.dataSource = scenario.databaseConfigMap.get(request.dataSource);
sampler = new JDBCSampler(request.name || "", request);
this.addRequestVariables(sampler, request);
} else if (request instanceof TCPRequest) {
sampler = new TCPSampler(request.name || "", new JMXTCPRequest(request, scenario));
}
this.addRequestVariables(sampler, request, scenario);
this.addDNSCacheManager(sampler, scenario.environment, request.useEnvironment);
this.addRequestExtractor(sampler, request);
@ -1205,20 +1207,13 @@ class JMXGenerator {
envArray = JSON.parse(environments);
}
envArray.forEach(item => {
if (item.name && !keys.has(item.name)) {
if (item.enable != false && item.name && !keys.has(item.name)) {
target.push(new KeyValue({name: item.name, value: item.value}));
}
})
}
addScenarioVariables(threadGroup, scenario) {
if (scenario.environment) {
let config = scenario.environment.config;
if (!(scenario.environment.config instanceof Object)) {
config = JSON.parse(scenario.environment.config);
}
this.addEnvironments(config.commonConfig.variables, scenario.variables)
}
let args = this.filterKV(scenario.variables);
if (args.length > 0) {
let name = scenario.name + " Variables";
@ -1226,11 +1221,23 @@ class JMXGenerator {
}
}
addRequestVariables(httpSamplerProxy, request) {
addRequestVariables(httpSamplerProxy, request, scenario) {
if (request.useEnvironment && scenario.environment) {
let config = scenario.environment.config;
if (!(scenario.environment.config instanceof Object)) {
config = JSON.parse(scenario.environment.config);
}
if (!request.variables) {
request.variables = [];
}
this.addEnvironments(config.commonConfig.variables, request.variables)
}
let name = request.name + " Variables";
let variables = this.filterKV(request.variables);
if (variables && variables.length > 0) {
httpSamplerProxy.put(new Arguments(name, variables));
if (request.variables) {
let variables = this.filterKV(request.variables);
if (variables && variables.length > 0) {
httpSamplerProxy.put(new Arguments(name, variables));
}
}
}
@ -1291,13 +1298,6 @@ class JMXGenerator {
}
addScenarioHeaders(threadGroup, scenario) {
if (scenario.environment) {
let config = scenario.environment.config;
if (!(scenario.environment.config instanceof Object)) {
config = JSON.parse(scenario.environment.config);
}
this.addEnvironments(config.httpConfig.headers, scenario.headers)
}
let headers = this.filterKV(scenario.headers);
if (headers.length > 0) {
let name = scenario.name + " Headers";
@ -1305,7 +1305,14 @@ class JMXGenerator {
}
}
addRequestHeader(httpSamplerProxy, request) {
addRequestHeader(httpSamplerProxy, request, scenario) {
if (request.useEnvironment && scenario.environment) {
let config = scenario.environment.config;
if (!(scenario.environment.config instanceof Object)) {
config = JSON.parse(scenario.environment.config);
}
this.addEnvironments(config.httpConfig.headers, request.headers)
}
let name = request.name + " Headers";
this.addBodyFormat(request);
let headers = this.filterKV(request.headers);
@ -1410,11 +1417,11 @@ class JMXGenerator {
body = this.filterKV(request.body.kvs);
this.addRequestBodyFile(httpSamplerProxy, request, testId);
} else {
httpSamplerProxy.boolProp('HTTPSampler.postBodyRaw', true);
body.push({name: '', value: request.body.raw, encode: false, enable: true});
}
if (request.method !== 'GET') {
httpSamplerProxy.boolProp('HTTPSampler.postBodyRaw', true);
httpSamplerProxy.add(new HTTPSamplerArguments(body));
}
}

View File

@ -286,12 +286,13 @@
},
getProject() {
if (this.planId) {
this.$post("/test/plan/project/", {planId: this.planId}, res => {
this.result = this.$post("/test/plan/project/", {planId: this.planId}, res => {
let data = res.data;
if (data) {
this.projects = data;
this.projectId = data[0].id;
this.projectName = data[0].name;
this.search();
}
})
}