File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
core/src/test/scala/org/apache/spark/scheduler Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -383,6 +383,21 @@ class SparkListenerSuite extends FunSuite with LocalSparkContext with Matchers
383383 }.size should be (1 )
384384 }
385385
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+
386401 /**
387402 * Assert that the given list of numbers has an average that is greater than zero.
388403 */
You can’t perform that action at this time.
0 commit comments