fix(接口测试): 修复hosts开启对应执行问题问题

--bug=1014043 --user=赵勇 【接口测试】github#14751,环境管理绑定hosts之后,接口耗时固定增加 https://www.tapd.cn/55049933/s/1181629
This commit is contained in:
fit2-zhao 2022-06-14 17:46:33 +08:00 committed by f2c-ci-robot[bot]
parent f43c82df4e
commit f761fe4bda
2 changed files with 4 additions and 4 deletions

View File

@ -33,7 +33,7 @@ public class MsDNSCacheManager extends MsTestElement {
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, MsParameter msParameter) {
ParameterConfig config = (ParameterConfig) msParameter;
// 非导出操作且不是启用状态则跳过执行
if (!config.isOperating() && !this.isEnable()) {
if (!this.isEnable()) {
return;
}
for (MsTestElement el : hashTree) {
@ -103,9 +103,9 @@ public class MsDNSCacheManager extends MsTestElement {
dnsCacheManager.setName(name);
dnsCacheManager.setProperty(TestElement.TEST_CLASS, DNSCacheManager.class.getName());
dnsCacheManager.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("DNSCachePanel"));
dnsCacheManager.setCustomResolver(true);
dnsCacheManager.setCustomResolver(false);
dnsCacheManager.setClearEachIteration(true);
hosts.forEach(host -> dnsCacheManager.addHost(host.getDomain(), host.getIp()));
hosts.forEach(host -> dnsCacheManager.addServer(host.getDomain()));
return dnsCacheManager;
}

View File

@ -254,7 +254,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
httpSamplerTree.add(arguments);
}
//判断是否要开启DNS
if (!config.isOperating() && config.isEffective(this.getProjectId()) && config.getConfig().get(this.getProjectId()).getCommonConfig() != null
if (config.isEffective(this.getProjectId()) && config.getConfig().get(this.getProjectId()).getCommonConfig() != null
&& config.getConfig().get(this.getProjectId()).getCommonConfig().isEnableHost()) {
MsDNSCacheManager.addEnvironmentVariables(httpSamplerTree, this.getName(), config.getConfig().get(this.getProjectId()));
MsDNSCacheManager.addEnvironmentDNS(httpSamplerTree, this.getName(), config.getConfig().get(this.getProjectId()), httpConfig);