[GitHub] [spark] beliefer commented on a change in pull request #28917: [SPARK-31847][CORE][TESTS] DAGSchedulerSuite: Rewrite the test framework to support apply specified spark configurations.

2020-06-29 Thread GitBox


beliefer commented on a change in pull request #28917:
URL: https://github.com/apache/spark/pull/28917#discussion_r447395194



##
File path: 
core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala
##
@@ -278,7 +280,26 @@ class DAGSchedulerSuite extends SparkFunSuite with 
LocalSparkContext with TimeLi
 
   override def beforeEach(): Unit = {
 super.beforeEach()
-init(new SparkConf())
+  }
+
+  override protected def test(testName: String, testTags: Tag*)(testFun: => 
Any)
+  (implicit pos: Position): Unit = {
+testWithSparkConf(testName, testTags: _*)()(testFun)(pos)
+  }
+
+  private def testWithSparkConf(testName: String, testTags: Tag*)
+  (pairs: (String, String)*)(testFun: => Any)(implicit pos: Position): 
Unit = {
+super.test(testName, testTags: _*) {
+  withSparkConf(pairs: _*)(testFun)
+}
+  }
+
+  /** Sets all configurations specified in `pairs`, calls `init`, and then 
calls `testFun` */
+  private def withSparkConf(pairs: (String, String)*)(testFun: => Any): Unit = 
{
+val conf = new SparkConf()
+pairs.foreach(kv => conf.set(kv._1, kv._2))
+init(conf)

Review comment:
   OK.





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



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



[GitHub] [spark] beliefer commented on a change in pull request #28917: [SPARK-31847][CORE][TESTS] DAGSchedulerSuite: Rewrite the test framework to support apply specified spark configurations.

2020-06-29 Thread GitBox


beliefer commented on a change in pull request #28917:
URL: https://github.com/apache/spark/pull/28917#discussion_r447395077



##
File path: 
core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala
##
@@ -278,7 +280,26 @@ class DAGSchedulerSuite extends SparkFunSuite with 
LocalSparkContext with TimeLi
 
   override def beforeEach(): Unit = {
 super.beforeEach()
-init(new SparkConf())
+  }
+
+  override protected def test(testName: String, testTags: Tag*)(testFun: => 
Any)
+  (implicit pos: Position): Unit = {
+testWithSparkConf(testName, testTags: _*)()(testFun)(pos)
+  }
+
+  private def testWithSparkConf(testName: String, testTags: Tag*)

Review comment:
   Most SQL-related configuration parameters can be changed dynamically, 
but most of Core's parameters are static.





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



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



[GitHub] [spark] beliefer commented on a change in pull request #28917: [SPARK-31847][CORE][TESTS] DAGSchedulerSuite: Rewrite the test framework to support apply specified spark configurations.

2020-06-29 Thread GitBox


beliefer commented on a change in pull request #28917:
URL: https://github.com/apache/spark/pull/28917#discussion_r447372063



##
File path: 
core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala
##
@@ -278,7 +280,26 @@ class DAGSchedulerSuite extends SparkFunSuite with 
LocalSparkContext with TimeLi
 
   override def beforeEach(): Unit = {
 super.beforeEach()
-init(new SparkConf())
+  }
+
+  override protected def test(testName: String, testTags: Tag*)(testFun: => 
Any)
+  (implicit pos: Position): Unit = {
+testWithSparkConf(testName, testTags: _*)()(testFun)(pos)
+  }
+
+  private def testWithSparkConf(testName: String, testTags: Tag*)
+  (pairs: (String, String)*)(testFun: => Any)(implicit pos: Position): 
Unit = {
+super.test(testName, testTags: _*) {
+  withSparkConf(pairs: _*)(testFun)
+}
+  }
+
+  /** Sets all configurations specified in `pairs`, calls `init`, and then 
calls `testFun` */
+  private def withSparkConf(pairs: (String, String)*)(testFun: => Any): Unit = 
{

Review comment:
   OK. I will simulate `SQLHelper`.





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



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



[GitHub] [spark] beliefer commented on a change in pull request #28917: [SPARK-31847][CORE][TESTS] DAGSchedulerSuite: Rewrite the test framework to support apply specified spark configurations.

2020-06-27 Thread GitBox


beliefer commented on a change in pull request #28917:
URL: https://github.com/apache/spark/pull/28917#discussion_r446593625



##
File path: 
core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala
##
@@ -278,7 +280,26 @@ class DAGSchedulerSuite extends SparkFunSuite with 
LocalSparkContext with TimeLi
 
   override def beforeEach(): Unit = {
 super.beforeEach()
-init(new SparkConf())
+  }
+
+  override protected def test(testName: String, testTags: Tag*)(testFun: => 
Any)
+  (implicit pos: Position): Unit = {
+testWithSparkConf(testName, testTags: _*)()(testFun)(pos)
+  }
+
+  protected def testWithSparkConf(testName: String, testTags: Tag*)

Review comment:
   OK





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



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