diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/dns/MsDNSCacheManager.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/dns/MsDNSCacheManager.java index 8f8891a8d1..cd9d6f495b 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/dns/MsDNSCacheManager.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/dns/MsDNSCacheManager.java @@ -33,7 +33,7 @@ public class MsDNSCacheManager extends MsTestElement { public void toHashTree(HashTree tree, List 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; } diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java index 68b416d36b..8567f63df3 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java @@ -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);