fix(接口测试): 修复SQL协议请求无法获取环境设置的问题

--bug=1011905 --user=宋天阳
【接口测试】-执行sql协议的接口case时提示数据源为空,实际上执行成功,但是场景中引用这个接口case后执行失败
{#_orginal_url#}
This commit is contained in:
song-tianyang 2022-04-02 15:27:37 +08:00 committed by 刘瑞斌
parent 697a919ebb
commit cab59fbac0
3 changed files with 3 additions and 4 deletions

View File

@ -93,7 +93,7 @@ public class MsJDBCPostProcessor extends MsTestElement {
// 数据兼容处理
if (config.getConfig() != null && StringUtils.isNotEmpty(this.getProjectId()) && config.getConfig().containsKey(this.getProjectId())) {
EnvironmentConfig environmentConfig = config.getConfig().get(this.getProjectId());
if(environmentConfig.getDatabaseConfigs() != null){
if(environmentConfig.getDatabaseConfigs() != null && StringUtils.isNotEmpty(environmentConfig.getApiEnvironmentid())){
this.environmentId = environmentConfig.getApiEnvironmentid();
}
// 1.8 之后 当前正常数据

View File

@ -93,7 +93,7 @@ public class MsJDBCPreProcessor extends MsTestElement {
// 数据兼容处理
if (config.getConfig() != null && StringUtils.isNotEmpty(this.getProjectId()) && config.getConfig().containsKey(this.getProjectId())) {
EnvironmentConfig environmentConfig = config.getConfig().get(this.getProjectId());
if(environmentConfig.getDatabaseConfigs() != null){
if(environmentConfig.getDatabaseConfigs() != null && StringUtils.isNotEmpty(environmentConfig.getApiEnvironmentid())){
this.environmentId = environmentConfig.getApiEnvironmentid();
}
// 1.8 之后 当前正常数据

View File

@ -103,7 +103,7 @@ public class MsJDBCSampler extends MsTestElement {
// 数据兼容处理
if (config.getConfig() != null && StringUtils.isNotEmpty(this.getProjectId()) && config.getConfig().containsKey(this.getProjectId())) {
EnvironmentConfig environmentConfig = config.getConfig().get(this.getProjectId());
if(environmentConfig.getDatabaseConfigs() != null){
if(environmentConfig.getDatabaseConfigs() != null && StringUtils.isNotEmpty(environmentConfig.getApiEnvironmentid())){
this.environmentId = environmentConfig.getApiEnvironmentid();
}
// 1.8 之后 当前正常数据
@ -131,7 +131,6 @@ public class MsJDBCSampler extends MsTestElement {
this.dataSource = null;
envConfig = this.initDataSource();
} else {
this.dataSource = null;
// 取当前环境下默认的一个数据源
if (config.isEffective(this.getProjectId())) {
if (config.getConfig().get(this.getProjectId()) != null) {