You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/07/08 15:31:13 UTC

[GitHub] [spark] dongjoon-hyun commented on a change in pull request #28931: [SPARK-32103][YARN] Handle IPv6 host/port split in YarnRMClient

dongjoon-hyun commented on a change in pull request #28931:
URL: https://github.com/apache/spark/pull/28931#discussion_r451635049



##########
File path: core/src/test/scala/org/apache/spark/util/UtilsSuite.scala
##########
@@ -1309,6 +1309,97 @@ class UtilsSuite extends SparkFunSuite with ResetSystemProperties with Logging {
     assert(Utils.buildLocationMetadata(paths, 15) == "[path0, path1, path2]")
     assert(Utils.buildLocationMetadata(paths, 25) == "[path0, path1, path2, path3]")
   }
+
+  test("checkHosts support IPV6 and IPV4") {
+    // IPV4 ips
+    Utils.checkHost("0.0.0.0")
+    intercept[AssertionError] {
+      Utils.checkHost("0.0.0.0:0")
+    }
+    intercept[AssertionError] {
+      Utils.checkHost("0.0.0.0:")
+    }
+
+    // IPV6 ips
+    Utils.checkHost("[::1]")
+    intercept[AssertionError] {
+      Utils.checkHost("[::1]:0")
+    }
+    intercept[AssertionError] {
+      Utils.checkHost("[::1]:")
+    }
+
+    // hostname
+    Utils.checkHost("localhost")
+    intercept[AssertionError] {
+      Utils.checkHost("localhost:0")
+    }
+    intercept[AssertionError] {
+      Utils.checkHost("localhost:")
+    }
+  }
+
+  test("checkHostPort support IPV6 and IPV4") {
+    // IPV4 ips
+    Utils.checkHostPort("0.0.0.0:0")
+    intercept[AssertionError] {
+      Utils.checkHostPort("0.0.0.0")
+    }
+
+    // IPV6 ips
+    Utils.checkHostPort("[::1]:0")
+    intercept[AssertionError] {
+      Utils.checkHostPort("[::1]")
+    }
+
+    // hostname
+    Utils.checkHostPort("localhost:0")
+    intercept[AssertionError] {
+      Utils.checkHostPort("localhost")
+    }
+  }
+
+  test("parseHostPort support IPV6 and IPV4") {
+    // IPV4 ips
+    var hostnamePort = Utils.parseHostPort("0.0.0.0:80")
+    assert(hostnamePort._1.equals("0.0.0.0"))
+    assert(hostnamePort._2 === 80)
+
+    hostnamePort = Utils.parseHostPort("0.0.0.0")
+    assert(hostnamePort._1.equals("0.0.0.0"))
+    assert(hostnamePort._2 === 0)
+
+    hostnamePort = Utils.parseHostPort("0.0.0.0:")
+    assert(hostnamePort._1.equals("0.0.0.0"))
+    assert(hostnamePort._2 === 0)
+
+

Review comment:
       nit. repeated blank lines.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org