Github user tdas commented on a diff in the pull request:
https://github.com/apache/spark/pull/5060#discussion_r34658011
--- Diff:
streaming/src/test/scala/org/apache/spark/streaming/CheckpointSuite.scala ---
@@ -191,6 +191,34 @@ class CheckpointSuite extends TestSuiteBase {
}
}
+ // This tests if "spark.driver.host" and "spark.driver.port" is set by
user, can be recovered
+ // with correct value.
+ test("correctly recover spark.driver.[host|port] from checkpoint") {
+ val conf = Map("spark.driver.host" -> "localhost", "spark.driver.port"
-> "9999")
+ conf.foreach(kv => System.setProperty(kv._1, kv._2))
+ ssc = new StreamingContext(master, framework, batchDuration)
+ val originalConf = ssc.conf
+ assert(originalConf.get("spark.driver.host") === "localhost")
+ assert(originalConf.get("spark.driver.port") === "9999")
+
+ val cp = new Checkpoint(ssc, Time(1000))
+ ssc.stop()
+
+ // Serialize/deserialize to simulate write to storage and reading it
back
+ val newCp = Utils.deserialize[Checkpoint](Utils.serialize(cp))
+
+ val newCpConf = newCp.createSparkConf()
+ assert(newCpConf.contains("spark.driver.host"))
+ assert(newCpConf.contains("spark.driver.port"))
+ assert(newCpConf.get("spark.driver.host") === "localhost")
--- End diff --
This just tests whether its correctly set in the new conf when it is set as
system property. you should also test the other case, where the new conf does
not have them when they are not in the property, even though it was present in
the original conf.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]