fix (接口自动化): 修复DNSCacheManager问题 #1006114

--bug=1006114 --user=赵勇 【github#5508】项目设... https://www.tapd.cn/55049933/s/1038606
This commit is contained in:
fit2-zhao 2021-08-24 15:03:50 +08:00 committed by fit2-zhao
parent abd51c5edd
commit 434e83e254
1 changed files with 7 additions and 2 deletions

View File

@ -38,7 +38,9 @@ public class MsDNSCacheManager extends MsTestElement {
public static void addEnvironmentVariables(HashTree samplerHashTree, String name, EnvironmentConfig config) {
name += "Environment Variables";
samplerHashTree.add(arguments(name, config.getCommonConfig().getVariables()));
if (CollectionUtils.isNotEmpty(config.getCommonConfig().getVariables())) {
samplerHashTree.add(arguments(name, config.getCommonConfig().getVariables()));
}
}
public static void addEnvironmentDNS(HashTree samplerHashTree, String name, EnvironmentConfig config, HttpConfig httpConfig) {
@ -54,7 +56,9 @@ public class MsDNSCacheManager extends MsTestElement {
}
}
});
samplerHashTree.add(dnsCacheManager(name + " DNSCacheManager", hosts));
if (CollectionUtils.isNotEmpty(hosts)) {
samplerHashTree.add(dnsCacheManager(name + " DNSCacheManager", hosts));
}
}
}
@ -78,6 +82,7 @@ public class MsDNSCacheManager extends MsTestElement {
dnsCacheManager.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("DNSCachePanel"));
dnsCacheManager.setCustomResolver(true);
hosts.forEach(host -> dnsCacheManager.addHost(host.getDomain(), host.getIp()));
hosts.forEach(host -> dnsCacheManager.addServer(host.getIp()));
return dnsCacheManager;
}