forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SPARK-3883: Refactored methods to resolve Akka address and made it po…
…ssible to easily configure multiple communication layers for SSL
- Loading branch information
1 parent
72b2541
commit 90a8762
Showing
18 changed files
with
114 additions
and
73 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -20,48 +20,46 @@ package org.apache.spark.deploy.master | |
import akka.actor.Address | ||
import org.scalatest.FunSuite | ||
|
||
import org.apache.spark.{SparkConf, SparkException} | ||
import org.apache.spark.{SSLOptions, SparkConf, SparkException} | ||
|
||
class MasterSuite extends FunSuite { | ||
|
||
test("toAkkaUrl") { | ||
val conf = new SparkConf(loadDefaults = false) | ||
val akkaUrl = Master.toAkkaUrl("spark://1.2.3.4:1234", conf) | ||
val akkaUrl = Master.toAkkaUrl("spark://1.2.3.4:1234", "akka.tcp") | ||
assert("akka.tcp://[email protected]:1234/user/Master" === akkaUrl) | ||
} | ||
|
||
test("toAkkaUrl with SSL") { | ||
val conf = new SparkConf(loadDefaults = false) | ||
conf.set("spark.ssl.enabled", "true") | ||
val akkaUrl = Master.toAkkaUrl("spark://1.2.3.4:1234", conf) | ||
val akkaUrl = Master.toAkkaUrl("spark://1.2.3.4:1234", "akka.ssl.tcp") | ||
assert("akka.ssl.tcp://[email protected]:1234/user/Master" === akkaUrl) | ||
} | ||
|
||
test("toAkkaUrl: a typo url") { | ||
val conf = new SparkConf(loadDefaults = false) | ||
val e = intercept[SparkException] { | ||
Master.toAkkaUrl("spark://1.2. 3.4:1234", conf) | ||
Master.toAkkaUrl("spark://1.2. 3.4:1234", "akka.tcp") | ||
} | ||
assert("Invalid master URL: spark://1.2. 3.4:1234" === e.getMessage) | ||
} | ||
|
||
test("toAkkaAddress") { | ||
val conf = new SparkConf(loadDefaults = false) | ||
val address = Master.toAkkaAddress("spark://1.2.3.4:1234", conf) | ||
val address = Master.toAkkaAddress("spark://1.2.3.4:1234", "akka.tcp") | ||
assert(Address("akka.tcp", "sparkMaster", "1.2.3.4", 1234) === address) | ||
} | ||
|
||
test("toAkkaAddress with SSL") { | ||
val conf = new SparkConf(loadDefaults = false) | ||
conf.set("spark.ssl.enabled", "true") | ||
val address = Master.toAkkaAddress("spark://1.2.3.4:1234", conf) | ||
val address = Master.toAkkaAddress("spark://1.2.3.4:1234", "akka.ssl.tcp") | ||
assert(Address("akka.ssl.tcp", "sparkMaster", "1.2.3.4", 1234) === address) | ||
} | ||
|
||
test("toAkkaAddress: a typo url") { | ||
val conf = new SparkConf(loadDefaults = false) | ||
val e = intercept[SparkException] { | ||
Master.toAkkaAddress("spark://1.2. 3.4:1234", conf) | ||
Master.toAkkaAddress("spark://1.2. 3.4:1234", "akka.tcp") | ||
} | ||
assert("Invalid master URL: spark://1.2. 3.4:1234" === e.getMessage) | ||
} | ||
|
Oops, something went wrong.