You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ij...@apache.org on 2020/10/20 14:01:28 UTC
[kafka] branch 2.5 updated: MINOR: Fix now that kafka.apache.org
resolves to 3 IP addresses (#9305)
This is an automated email from the ASF dual-hosted git repository.
ijuma pushed a commit to branch 2.5
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/2.5 by this push:
new 28c8cc5 MINOR: Fix now that kafka.apache.org resolves to 3 IP addresses (#9305)
28c8cc5 is described below
commit 28c8cc59925fc864e789e8a0a04f9f616baac67a
Author: Justine Olshan <jo...@confluent.io>
AuthorDate: Tue Oct 20 07:00:21 2020 -0700
MINOR: Fix now that kafka.apache.org resolves to 3 IP addresses (#9305)
ClusterConnectStatesTest and ClientUtilsTest were failing because they expected
kafka.apache.org to resolve to 2 IP addresses. This updates the tests so they reflect
that DNS resolves to 3 addresses.
Reviewers: Ismael Juma <is...@juma.me.uk>
---
.../src/test/java/org/apache/kafka/clients/ClientUtilsTest.java | 2 +-
.../org/apache/kafka/clients/ClusterConnectionStatesTest.java | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/clients/src/test/java/org/apache/kafka/clients/ClientUtilsTest.java b/clients/src/test/java/org/apache/kafka/clients/ClientUtilsTest.java
index 5dd65ed..572896f 100644
--- a/clients/src/test/java/org/apache/kafka/clients/ClientUtilsTest.java
+++ b/clients/src/test/java/org/apache/kafka/clients/ClientUtilsTest.java
@@ -107,7 +107,7 @@ public class ClientUtilsTest {
@Test
public void testResolveDnsLookupAllIps() throws UnknownHostException {
- assertEquals(2, ClientUtils.resolve("kafka.apache.org", ClientDnsLookup.USE_ALL_DNS_IPS).size());
+ assertTrue(ClientUtils.resolve("kafka.apache.org", ClientDnsLookup.USE_ALL_DNS_IPS).size() > 1);
}
private List<InetSocketAddress> checkWithoutLookup(String... url) {
diff --git a/clients/src/test/java/org/apache/kafka/clients/ClusterConnectionStatesTest.java b/clients/src/test/java/org/apache/kafka/clients/ClusterConnectionStatesTest.java
index 2a427cc..fbb4497 100644
--- a/clients/src/test/java/org/apache/kafka/clients/ClusterConnectionStatesTest.java
+++ b/clients/src/test/java/org/apache/kafka/clients/ClusterConnectionStatesTest.java
@@ -256,7 +256,7 @@ public class ClusterConnectionStatesTest {
@Test
public void testMultipleIPsWithDefault() 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.DEFAULT);
InetAddress currAddress = connectionStates.currentAddress(nodeId1);
@@ -266,22 +266,21 @@ public class ClusterConnectionStatesTest {
@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);
+ assertNotSame(addr1, addr3);
}
@Test
public void testHostResolveChange() throws UnknownHostException, ReflectiveOperationException {
- 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.DEFAULT);
InetAddress addr1 = connectionStates.currentAddress(nodeId1);