From effa648e7b3db7f3cc4eb3d08e81331c02ac3172 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 24 Aug 2021 15:03:50 +0800 Subject: [PATCH] =?UTF-8?q?fix=20(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E5=A4=8DDNSCacheManager=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20#1006114=20--bug=3D1006114=20--user=3D=E8=B5=B5?= =?UTF-8?q?=E5=8B=87=20=E3=80=90github#5508=E3=80=91=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E8=AE=BE...=20https://www.tapd.cn/55049933/s/1038606?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/definition/request/dns/MsDNSCacheManager.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 00fb73cec0..88db977993 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 @@ -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; }