jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject [jmeter] branch master updated: DNS Cache Manager - custom DNS resolver does not use system resolver by default
Date Tue, 26 Jan 2021 17:19:39 GMT
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new da5fb83  DNS Cache Manager - custom DNS resolver does not use system resolver by
default
da5fb83 is described below

commit da5fb8319b02666062e415f4823ee4bcde2a8639
Author: Felix Schumacher <felix.schumacher@internetallee.de>
AuthorDate: Sat Jan 2 21:26:44 2021 +0100

    DNS Cache Manager - custom DNS resolver does not use system resolver by default
    
    Bugzilla Id: 64318
---
 .../apache/jmeter/protocol/http/control/DNSCacheManager.java   |  7 +++----
 .../jmeter/protocol/http/control/DNSCacheManagerSpec.groovy    | 10 ++++++++++
 xdocs/changes.xml                                              |  1 +
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/control/DNSCacheManager.java
b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/control/DNSCacheManager.java
index be4be22..08c53d5 100644
--- a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/control/DNSCacheManager.java
+++ b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/control/DNSCacheManager.java
@@ -249,12 +249,11 @@ public class DNSCacheManager extends ConfigTestElement implements TestIterationL
                 throw new UnknownHostException("Could not resolve host:" + host
                         + ", failed to initialize resolver or no resolver found");
             } else if (extendedResolver.getResolvers().length > 0) {
-                addresses = customRequestLookup(host);
+                return customRequestLookup(host);
             }
-        } else {
-            addresses = systemDefaultDnsResolver.resolve(host);
-            logCache("miss (resolved with system resolver)", host, addresses);
         }
+        addresses = systemDefaultDnsResolver.resolve(host);
+        logCache("miss (resolved with system resolver)", host, addresses);
 
         return addresses;
     }
diff --git a/src/protocol/http/src/test/groovy/org/apache/jmeter/protocol/http/control/DNSCacheManagerSpec.groovy
b/src/protocol/http/src/test/groovy/org/apache/jmeter/protocol/http/control/DNSCacheManagerSpec.groovy
index 0ff63dc..06f3d22 100644
--- a/src/protocol/http/src/test/groovy/org/apache/jmeter/protocol/http/control/DNSCacheManagerSpec.groovy
+++ b/src/protocol/http/src/test/groovy/org/apache/jmeter/protocol/http/control/DNSCacheManagerSpec.groovy
@@ -80,6 +80,16 @@ class DNSCacheManagerSpec extends Specification {
             !sut.resolve(VALID_HOSTNAME).contains(InetAddress.getByName("127.0.0.1"))
     }
 
+    @Requires({ localDNSResolverOK })
+    def "A custom resolver with a host entry will still fall back to system lookup"() {
+        given:
+            sut.setCustomResolver(true)
+            sut.addHost("jmeter.example.org", "127.0.0.1")
+        expect:
+            // uses real DNS server
+            sut.resolve(VALID_HOSTNAME).contains(InetAddress.getByName(VALID_HOSTNAME))
+    }
+
     def "If using an invalid server resolve throws UnknownHostException"() {
         given:
             sut.addServer(INVALID_DNS_SERVER)
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index 54fc200..3af23da 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -158,6 +158,7 @@ Summary
 
 <h3>General</h3>
 <ul>
+  <li><bug>64318</bug>DNS Cache Manager - custom DNS resolver does not
use system resolver by default</li>
 </ul>
 
  <!--  =================== Thanks =================== -->


Mime
View raw message