mumrah commented on a change in pull request #9294:
URL: https://github.com/apache/kafka/pull/9294#discussion_r490417685



##########
File path: 
clients/src/test/java/org/apache/kafka/clients/ClusterConnectionStatesTest.java
##########
@@ -273,22 +273,21 @@ public void testMultipleIPsWithDefault() throws 
UnknownHostException {
 
     @Test
     public void testMultipleIPsWithUseAll() throws UnknownHostException {
-        assertEquals(2, ClientUtils.resolve(hostTwoIps, 
ClientDnsLookup.USE_ALL_DNS_IPS).size());
+        assertTrue(ClientUtils.resolve(hostTwoIps, 
ClientDnsLookup.USE_ALL_DNS_IPS).size() > 1);
 
         connectionStates.connecting(nodeId1, time.milliseconds(), hostTwoIps, 
ClientDnsLookup.USE_ALL_DNS_IPS);
         InetAddress addr1 = connectionStates.currentAddress(nodeId1);
         connectionStates.connecting(nodeId1, time.milliseconds(), hostTwoIps, 
ClientDnsLookup.USE_ALL_DNS_IPS);
         InetAddress addr2 = connectionStates.currentAddress(nodeId1);
         assertNotSame(addr1, addr2);
-
         connectionStates.connecting(nodeId1, time.milliseconds(), hostTwoIps, 
ClientDnsLookup.USE_ALL_DNS_IPS);
         InetAddress addr3 = connectionStates.currentAddress(nodeId1);
-        assertSame(addr1, addr3);

Review comment:
       Hmm, so previously (and also with this change) we are assuming that we 
will get different resolved IPs for each connection to apache.kafka.org? This 
seems to rely on round-robbin DNS resolution that we can't really control. I 
think these assertions will always be prone to failure unless we can control 
the DNS server like @dajac suggested.
   
   I guess we can commit this to unblock the tests, but we should definitely 
prioritize a better fix.

##########
File path: clients/src/test/java/org/apache/kafka/clients/ClientUtilsTest.java
##########
@@ -102,20 +102,20 @@ public void testResolveUnknownHostException() throws 
UnknownHostException {
 
     @Test
     public void testResolveDnsLookup() throws UnknownHostException {
-        // Note that kafka.apache.org resolves to 2 IP addresses
+        // Note that kafka.apache.org resolves to at least 2 IP addresses

Review comment:
       Comment here and below refer to 2 IP addresses still.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to