You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by rx...@apache.org on 2015/05/30 07:57:55 UTC
spark git commit: [SPARK-7558] Guard against direct uses of FunSuite
/ FunSuiteLike
Repository: spark
Updated Branches:
refs/heads/master 7ed06c399 -> 609c4923f
[SPARK-7558] Guard against direct uses of FunSuite / FunSuiteLike
This is a follow-up patch to #6441.
Author: Andrew Or <an...@databricks.com>
Closes #6510 from andrewor14/extends-funsuite-check and squashes the following commits:
6618b46 [Andrew Or] Exempt SparkSinkSuite from the FunSuite check
99d02ac [Andrew Or] Merge branch 'master' of github.com:apache/spark into extends-funsuite-check
48874dd [Andrew Or] Guard against direct uses of FunSuite / FunSuiteLike
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/609c4923
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/609c4923
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/609c4923
Branch: refs/heads/master
Commit: 609c4923f98c188bce60ae35c1c8a08a8dfd95f1
Parents: 7ed06c3
Author: Andrew Or <an...@databricks.com>
Authored: Fri May 29 22:57:46 2015 -0700
Committer: Reynold Xin <rx...@databricks.com>
Committed: Fri May 29 22:57:46 2015 -0700
----------------------------------------------------------------------
core/src/test/scala/org/apache/spark/SparkFunSuite.scala | 2 ++
.../apache/spark/streaming/flume/sink/SparkSinkSuite.scala | 9 +++++++++
scalastyle-config.xml | 7 +++++++
3 files changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/609c4923/core/src/test/scala/org/apache/spark/SparkFunSuite.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/org/apache/spark/SparkFunSuite.scala b/core/src/test/scala/org/apache/spark/SparkFunSuite.scala
index 0327dfa..8cb3443 100644
--- a/core/src/test/scala/org/apache/spark/SparkFunSuite.scala
+++ b/core/src/test/scala/org/apache/spark/SparkFunSuite.scala
@@ -17,12 +17,14 @@
package org.apache.spark
+// scalastyle:off
import org.scalatest.{FunSuite, Outcome}
/**
* Base abstract class for all unit tests in Spark for handling common functionality.
*/
private[spark] abstract class SparkFunSuite extends FunSuite with Logging {
+// scalastyle:on
/**
* Log the suite name and the test name before and after each test.
http://git-wip-us.apache.org/repos/asf/spark/blob/609c4923/external/flume-sink/src/test/scala/org/apache/spark/streaming/flume/sink/SparkSinkSuite.scala
----------------------------------------------------------------------
diff --git a/external/flume-sink/src/test/scala/org/apache/spark/streaming/flume/sink/SparkSinkSuite.scala b/external/flume-sink/src/test/scala/org/apache/spark/streaming/flume/sink/SparkSinkSuite.scala
index 650b2fb..605b3fe 100644
--- a/external/flume-sink/src/test/scala/org/apache/spark/streaming/flume/sink/SparkSinkSuite.scala
+++ b/external/flume-sink/src/test/scala/org/apache/spark/streaming/flume/sink/SparkSinkSuite.scala
@@ -31,9 +31,18 @@ import org.apache.flume.Context
import org.apache.flume.channel.MemoryChannel
import org.apache.flume.event.EventBuilder
import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory
+
+// Due to MNG-1378, there is not a way to include test dependencies transitively.
+// We cannot include Spark core tests as a dependency here because it depends on
+// Spark core main, which has too many dependencies to require here manually.
+// For this reason, we continue to use FunSuite and ignore the scalastyle checks
+// that fail if this is detected.
+//scalastyle:off
import org.scalatest.FunSuite
class SparkSinkSuite extends FunSuite {
+//scalastyle:on
+
val eventsPerBatch = 1000
val channelCapacity = 5000
http://git-wip-us.apache.org/repos/asf/spark/blob/609c4923/scalastyle-config.xml
----------------------------------------------------------------------
diff --git a/scalastyle-config.xml b/scalastyle-config.xml
index 68c8ce3..890bf37 100644
--- a/scalastyle-config.xml
+++ b/scalastyle-config.xml
@@ -153,4 +153,11 @@
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.NotImplementedErrorUsage" enabled="true"></check>
+ <!-- As of SPARK-7558, all tests in Spark should extend o.a.s.SparkFunSuite instead of FunSuited directly -->
+ <check level="error" class="org.scalastyle.scalariform.TokenChecker" enabled="true">
+ <parameters>
+ <parameter name="regex">^FunSuite[A-Za-z]*$</parameter>
+ </parameters>
+ <customMessage>Tests must extend org.apache.spark.SparkFunSuite instead.</customMessage>
+ </check>
</scalastyle>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org