-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-32103][CORE] Support IPv6 host/port in core module #28931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
PavithraRamachandran
wants to merge
1
commit into
apache:master
from
PavithraRamachandran:ipv6_issue
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1309,6 +1309,103 @@ 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("checkHost supports both IPV4 and IPV6") { | ||
| // IPV4 ips | ||
| Utils.checkHost("0.0.0.0") | ||
| var e: AssertionError = intercept[AssertionError] { | ||
| Utils.checkHost("0.0.0.0:0") | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case, it would be great if we check the error message to prevent future regression. |
||
| assert(e.getMessage.contains("Expected hostname or IP but got 0.0.0.0:0")) | ||
| e = intercept[AssertionError] { | ||
| Utils.checkHost("0.0.0.0:") | ||
| } | ||
| assert(e.getMessage.contains("Expected hostname or IP but got 0.0.0.0:")) | ||
| // IPV6 ips | ||
| Utils.checkHost("[::1]") | ||
| e = intercept[AssertionError] { | ||
| Utils.checkHost("[::1]:0") | ||
| } | ||
| assert(e.getMessage.contains("Expected hostname or IPv6 IP enclosed in [] but got [::1]:0")) | ||
| e = intercept[AssertionError] { | ||
| Utils.checkHost("[::1]:") | ||
| } | ||
| assert(e.getMessage.contains("Expected hostname or IPv6 IP enclosed in [] but got [::1]:")) | ||
| // hostname | ||
| Utils.checkHost("localhost") | ||
| e = intercept[AssertionError] { | ||
| Utils.checkHost("localhost:0") | ||
| } | ||
| assert(e.getMessage.contains("Expected hostname or IP but got localhost:0")) | ||
| e = intercept[AssertionError] { | ||
| Utils.checkHost("localhost:") | ||
| } | ||
| assert(e.getMessage.contains("Expected hostname or IP but got localhost:")) | ||
| } | ||
|
|
||
| test("checkHostPort support IPV6 and IPV4") { | ||
| // IPV4 ips | ||
| Utils.checkHostPort("0.0.0.0:0") | ||
| var e: AssertionError = intercept[AssertionError] { | ||
| Utils.checkHostPort("0.0.0.0") | ||
| } | ||
| assert(e.getMessage.contains("Expected host and port but got 0.0.0.0")) | ||
|
|
||
| // IPV6 ips | ||
| Utils.checkHostPort("[::1]:0") | ||
| e = intercept[AssertionError] { | ||
| Utils.checkHostPort("[::1]") | ||
| } | ||
| assert(e.getMessage.contains("Expected host and port but got [::1]")) | ||
|
|
||
| // hostname | ||
| Utils.checkHostPort("localhost:0") | ||
| e = intercept[AssertionError] { | ||
| Utils.checkHostPort("localhost") | ||
| } | ||
| assert(e.getMessage.contains("Expected host and port but got 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) | ||
|
|
||
| // IPV6 ips | ||
| hostnamePort = Utils.parseHostPort("[::1]:80") | ||
| assert(hostnamePort._1.equals("[::1]")) | ||
| assert(hostnamePort._2 === 80) | ||
|
|
||
| hostnamePort = Utils.parseHostPort("[::1]") | ||
| assert(hostnamePort._1.equals("[::1]")) | ||
| assert(hostnamePort._2 === 0) | ||
|
|
||
| hostnamePort = Utils.parseHostPort("[::1]:") | ||
| assert(hostnamePort._1.equals("[::1]")) | ||
| assert(hostnamePort._2 === 0) | ||
|
|
||
| // hostname | ||
| hostnamePort = Utils.parseHostPort("localhost:80") | ||
| assert(hostnamePort._1.equals("localhost")) | ||
| assert(hostnamePort._2 === 80) | ||
|
|
||
| hostnamePort = Utils.parseHostPort("localhost") | ||
| assert(hostnamePort._1.equals("localhost")) | ||
| assert(hostnamePort._2 === 0) | ||
|
|
||
| hostnamePort = Utils.parseHostPort("localhost:") | ||
| assert(hostnamePort._1.equals("localhost")) | ||
| assert(hostnamePort._2 === 0) | ||
| } | ||
| } | ||
|
|
||
| private class SimpleExtension | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.