fix(接口测试): 修复SQL数据源为空时无法收到结果问题
--bug=1045163 --user=赵勇 [接口测试]github#32619运行环境中不配置数据源链接或配错误的链接并且用例中写了SQL脚本时,执行用例会卡死。 https://www.tapd.cn/55049933/s/1564930 Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
parent
cf08833361
commit
de4b303a45
|
@ -73,10 +73,15 @@ public class MsJDBCPostProcessor extends MsTestElement {
|
||||||
LoggerUtil.error(this.getName() + ",未找到数据源", JSONUtil.toJSONString(config));
|
LoggerUtil.error(this.getName() + ",未找到数据源", JSONUtil.toJSONString(config));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.dataSource == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
JDBCPostProcessor jdbcPostProcessor = jdbcPostProcessor(config);
|
JDBCPostProcessor jdbcPostProcessor = jdbcPostProcessor(config);
|
||||||
final HashTree samplerHashTree = tree.add(jdbcPostProcessor);
|
final HashTree samplerHashTree = tree.add(jdbcPostProcessor);
|
||||||
|
|
||||||
tree.add(ElementUtil.jdbcDataSource(jdbcPostProcessor.getDataSource(), this.dataSource));
|
tree.add(ElementUtil.jdbcDataSource(jdbcPostProcessor.getDataSource(), this.dataSource));
|
||||||
|
|
||||||
ElementUtil.jdbcArguments(this.getName(), this.getVariables(), tree);
|
ElementUtil.jdbcArguments(this.getName(), this.getVariables(), tree);
|
||||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||||
hashTree.forEach(el -> {
|
hashTree.forEach(el -> {
|
||||||
|
|
|
@ -7,7 +7,6 @@ import io.metersphere.api.dto.scenario.DatabaseConfig;
|
||||||
import io.metersphere.api.dto.scenario.KeyValue;
|
import io.metersphere.api.dto.scenario.KeyValue;
|
||||||
import io.metersphere.commons.constants.ElementConstants;
|
import io.metersphere.commons.constants.ElementConstants;
|
||||||
import io.metersphere.commons.constants.RequestTypeConstants;
|
import io.metersphere.commons.constants.RequestTypeConstants;
|
||||||
import io.metersphere.commons.exception.MSException;
|
|
||||||
import io.metersphere.commons.utils.BeanUtils;
|
import io.metersphere.commons.utils.BeanUtils;
|
||||||
import io.metersphere.commons.utils.JSONUtil;
|
import io.metersphere.commons.utils.JSONUtil;
|
||||||
import io.metersphere.commons.vo.JDBCProcessorVO;
|
import io.metersphere.commons.vo.JDBCProcessorVO;
|
||||||
|
@ -74,6 +73,10 @@ public class MsJDBCPreProcessor extends MsTestElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.dataSource == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
JDBCPreProcessor jdbcPreProcessor = jdbcPreProcessor(config);
|
JDBCPreProcessor jdbcPreProcessor = jdbcPreProcessor(config);
|
||||||
final HashTree samplerHashTree = tree.add(jdbcPreProcessor);
|
final HashTree samplerHashTree = tree.add(jdbcPreProcessor);
|
||||||
// 数据源
|
// 数据源
|
||||||
|
|
Loading…
Reference in New Issue