aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/scala
diff options
context:
space:
mode:
authorSteve Loughran <stevel@apache.org>2016-12-12 12:24:53 -0800
committerMarcelo Vanzin <vanzin@cloudera.com>2016-12-12 12:24:53 -0800
commit586d19822810129c6cb840c2bd4464ad34c88458 (patch)
tree40b3190460aac73f61b719cd23768b38835ab4f3 /core/src/test/scala
parent70ffff21f769b149bee787fe5901d9844a4d97b8 (diff)
downloadspark-586d19822810129c6cb840c2bd4464ad34c88458.tar.gz
spark-586d19822810129c6cb840c2bd4464ad34c88458.tar.bz2
spark-586d19822810129c6cb840c2bd4464ad34c88458.zip
[SPARK-15844][CORE] HistoryServer doesn't come up if spark.authenticate = true
## What changes were proposed in this pull request? During history server startup, the spark configuration is examined. If security.authentication is set, log at debug and set the value to false, so that {{SecurityManager}} can be created. ## How was this patch tested? A new test in `HistoryServerSuite` sets the `spark.authenticate` property to true, tries to create a security manager via a new package-private method `HistoryServer.createSecurityManager(SparkConf)`. This is the method used in `HistoryServer.main`. All other instantiations of a security manager in `HistoryServerSuite` have been switched to the new method, for consistency with the production code. Author: Steve Loughran <stevel@apache.org> Closes #13579 from steveloughran/history/SPARK-15844-security.
Diffstat (limited to 'core/src/test/scala')
-rw-r--r--core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala17
1 files changed, 14 insertions, 3 deletions
diff --git a/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala b/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala
index 715811a46f..d3b79dd3e3 100644
--- a/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala
+++ b/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala
@@ -75,7 +75,7 @@ class HistoryServerSuite extends SparkFunSuite with BeforeAndAfter with Matchers
.set("spark.testing", "true")
provider = new FsHistoryProvider(conf)
provider.checkForLogs()
- val securityManager = new SecurityManager(conf)
+ val securityManager = HistoryServer.createSecurityManager(conf)
server = new HistoryServer(conf, provider, securityManager, 18080)
server.initialize()
@@ -288,7 +288,7 @@ class HistoryServerSuite extends SparkFunSuite with BeforeAndAfter with Matchers
provider = new FsHistoryProvider(conf)
provider.checkForLogs()
- val securityManager = new SecurityManager(conf)
+ val securityManager = HistoryServer.createSecurityManager(conf)
server = new HistoryServer(conf, provider, securityManager, 18080)
server.initialize()
@@ -349,6 +349,17 @@ class HistoryServerSuite extends SparkFunSuite with BeforeAndAfter with Matchers
}
+ /**
+ * Verify that the security manager needed for the history server can be instantiated
+ * when `spark.authenticate` is `true`, rather than raise an `IllegalArgumentException`.
+ */
+ test("security manager starts with spark.authenticate set") {
+ val conf = new SparkConf()
+ .set("spark.testing", "true")
+ .set(SecurityManager.SPARK_AUTH_CONF, "true")
+ HistoryServer.createSecurityManager(conf)
+ }
+
test("incomplete apps get refreshed") {
implicit val webDriver: WebDriver = new HtmlUnitDriver
@@ -368,7 +379,7 @@ class HistoryServerSuite extends SparkFunSuite with BeforeAndAfter with Matchers
.set("spark.history.cache.window", "250ms")
.remove("spark.testing")
val provider = new FsHistoryProvider(myConf)
- val securityManager = new SecurityManager(myConf)
+ val securityManager = HistoryServer.createSecurityManager(myConf)
sc = new SparkContext("local", "test", myConf)
val logDirUri = logDir.toURI