@@ -21,12 +21,11 @@ import java.util.concurrent.Semaphore
2121
2222import scala .collection .mutable
2323
24- import org .apache .spark .{LocalSparkContext , SparkConf , SparkContext }
24+ import org .scalatest .{FunSuite , Matchers }
25+
2526import org .apache .spark .executor .TaskMetrics
2627import org .apache .spark .util .ResetSystemProperties
27-
28- import org .mockito .Mockito ._
29- import org .scalatest .{FunSuite , Matchers }
28+ import org .apache .spark .{LocalSparkContext , SparkConf , SparkContext }
3029
3130class SparkListenerSuite extends FunSuite with LocalSparkContext with Matchers
3231 with ResetSystemProperties {
@@ -370,34 +369,6 @@ class SparkListenerSuite extends FunSuite with LocalSparkContext with Matchers
370369 }.size should be (1 )
371370 }
372371
373- test(" registering listeners via SPARK_EXTRA_LISTENERS" ) {
374- val SPARK_EXTRA_LISTENERS = classOf [ListenerThatAcceptsSparkConf ].getName + " ," +
375- classOf [BasicJobCounter ].getName
376- val conf = spy(new SparkConf ().setMaster(" local" ).setAppName(" test" ))
377- when(conf.getenv(" SPARK_EXTRA_LISTENERS" )).thenReturn(SPARK_EXTRA_LISTENERS )
378- when(conf.clone).thenReturn(conf) // so that our mock is still used
379- sc = new SparkContext (conf)
380- sc.listenerBus.sparkListeners.collect { case x : BasicJobCounter => x}.size should be (1 )
381- sc.listenerBus.sparkListeners.collect {
382- case x : ListenerThatAcceptsSparkConf => x
383- }.size should be (1 )
384- }
385-
386- test(" spark.extraListeners and SPARK_EXTRA_LISTENERS configurations are merged" ) {
387- // This test ensures that we don't accidentally change the behavior such that one setting
388- // overrides the other:
389- val SPARK_EXTRA_LISTENERS = classOf [ListenerThatAcceptsSparkConf ].getName
390- val conf = spy(new SparkConf ().setMaster(" local" ).setAppName(" test" )
391- .set(" spark.extraListeners" , classOf [BasicJobCounter ].getName))
392- when(conf.getenv(" SPARK_EXTRA_LISTENERS" )).thenReturn(SPARK_EXTRA_LISTENERS )
393- when(conf.clone).thenReturn(conf) // so that our mock is still used
394- sc = new SparkContext (conf)
395- sc.listenerBus.sparkListeners.collect { case x : BasicJobCounter => x}.size should be (1 )
396- sc.listenerBus.sparkListeners.collect {
397- case x : ListenerThatAcceptsSparkConf => x
398- }.size should be (1 )
399- }
400-
401372 /**
402373 * Assert that the given list of numbers has an average that is greater than zero.
403374 */
0 commit comments