fix(接口测试): 修复环境中开启Hosts后请求变慢问题

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

View File

@ -76,8 +76,8 @@ public class MsDNSCacheManager extends MsTestElement {
String hostDomain = host.getDomain().trim().replace("http://", "").replace("https://", "");
if (StringUtils.equals(hostDomain, domain)) {
dnsMap.put(hostDomain, host.getIp());
}else if(StringUtils.startsWith(hostDomain,domain+":")){
dnsMap.put(domain,StringUtils.replace(hostDomain,domain,host.getIp()));
} else if (StringUtils.startsWith(hostDomain, domain + ":")) {
dnsMap.put(domain, StringUtils.replace(hostDomain, domain, host.getIp()));
}
}
});
@ -105,7 +105,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()));
hosts.forEach(host -> dnsCacheManager.addServer(host.getDomain()));
return dnsCacheManager;
}