You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2019/10/03 20:54:06 UTC
[tinkerpop] 01/03: TINKERPOP-2289 Disabled IPv6 in tests
This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit ed9071f8a6216325440c2d653ba6cdb9ad9bbf57
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Thu Oct 3 16:50:22 2019 -0400
TINKERPOP-2289 Disabled IPv6 in tests
This change was a bit of a follow on to this issue where it was raised that INetAddress.getAllByName(String) might return both the IPv6 and IPv4 addresses when specifying a hostname to the cluster. That would mean that the Cluster would think that there were two hosts despite them likely pointing to the same instances (as in, localhost). By disabling IPv6 in tests we should avoid that problem for developers. Also added some javadoc to point folks in the right direction in case they ru [...]
---
.../java/org/apache/tinkerpop/gremlin/driver/Cluster.java | 9 ++++++++-
gremlin-test/pom.xml | 2 +-
pom.xml | 13 +++++--------
3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
index 12fd232..b424c5a 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
@@ -967,8 +967,15 @@ public final class Cluster {
/**
* Adds an address representing a group of Gremlin Servers, which will be added to the list of servers a
* {@link Client} will try to contact to send requests to. The address should be parseable by
- * {@link InetAddress#getAllByName(String)}. That's the only validation performed at this point.
+ * {@code InetAddress#getAllByName(String)}. That's the only validation performed at this point.
* No connection to the hosts is attempted.
+ * <p/>
+ * Note that if the address argument is a hostname that resolves to multiple {@code INetAddress} objects that
+ * happen to point to the same physical Gremlin Server instance the driver will think that it has more hosts
+ * for it to send requests to than there are in reality. A common situation in which this issue may occur is
+ * when IPv6 addressing is present as {@code InetAddress#getAllByName(String)} will return both the IPv6 and
+ * the IPv4 addresses. In these cases, the issue can be resolved by simply using the IP address directly or
+ * setting the Java system property {@code -Djava.net.preferIPv4Stack=true}.
*/
public Builder addContactPoint(final String address) {
try {
diff --git a/gremlin-test/pom.xml b/gremlin-test/pom.xml
index 4c57518..00c9a03 100644
--- a/gremlin-test/pom.xml
+++ b/gremlin-test/pom.xml
@@ -96,7 +96,7 @@ limitations under the License.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <argLine>-Dlog4j.configuration=${log4j-test.properties} -Dbuild.dir=${project.build.directory} -Dis.testing=true
+ <argLine>-Dlog4j.configuration=${log4j-test.properties} -Dbuild.dir=${project.build.directory} -Dis.testing=true -Djava.net.preferIPv4Stack=true
</argLine>
<excludes>
<exclude>TraversalInterruptionTest.java</exclude>
diff --git a/pom.xml b/pom.xml
index ffb0f04..b67e76e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -452,7 +452,7 @@ limitations under the License.
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
- <argLine>-Dlog4j.configuration=${log4j-test.properties} -Dbuild.dir=${project.build.directory} -Dis.testing=true
+ <argLine>-Dlog4j.configuration=${log4j-test.properties} -Dbuild.dir=${project.build.directory} -Dis.testing=true -Djava.net.preferIPv4Stack=true
</argLine>
<excludes>
<exclude>**/*IntegrateTest.java</exclude>
@@ -474,8 +474,7 @@ limitations under the License.
<include>**/*IntegrateTest.java</include>
</includes>
<skipTests>${skipIntegrationTests}</skipTests>
- <argLine>-Dlog4j.configuration=${log4j-test.properties} -Dhost=localhost -Dport=8182
- -Dbuild.dir=${project.build.directory} -Dis.testing=true
+ <argLine>-Dlog4j.configuration=${log4j-test.properties} -Dhost=localhost -Dport=8182 -Dbuild.dir=${project.build.directory} -Dis.testing=true -Djava.net.preferIPv4Stack=true
</argLine>
<summaryFile>target/failsafe-reports/failsafe-integration.xml</summaryFile>
</configuration>
@@ -1413,8 +1412,7 @@ limitations under the License.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <argLine>-Dlog4j.configuration=${log4j-silent.properties}
- -Dbuild.dir=${project.build.directory} -Dis.testing=true
+ <argLine>-Dlog4j.configuration=${log4j-silent.properties} -Dbuild.dir=${project.build.directory} -Dis.testing=true -Djava.net.preferIPv4Stack=true
</argLine>
<excludes>
<exclude>**/*IntegrateTest.java</exclude>
@@ -1511,7 +1509,7 @@ limitations under the License.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <argLine>-Dlog4j.configuration=${log4j-test.properties} -Dbuild.dir=${project.build.directory} -Dis.testing=true ${surefireArgLine}
+ <argLine>-Dlog4j.configuration=${log4j-test.properties} -Dbuild.dir=${project.build.directory} -Dis.testing=true ${surefireArgLine} -Djava.net.preferIPv4Stack=true
</argLine>
</configuration>
</plugin>
@@ -1519,8 +1517,7 @@ limitations under the License.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
- <argLine>-Dlog4j.configuration=${log4j-test.properties} -Dhost=localhost -Dport=8182
- -Dbuild.dir=${project.build.directory} -Dis.testing=true ${failsafeArgLine}
+ <argLine>-Dlog4j.configuration=${log4j-test.properties} -Dhost=localhost -Dport=8182 -Dbuild.dir=${project.build.directory} -Dis.testing=true ${failsafeArgLine} -Djava.net.preferIPv4Stack=true
</argLine>
</configuration>
</plugin>