You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ya...@apache.org on 2025/08/07 16:58:11 UTC

(spark) branch master updated: [SPARK-53168][CORE][TESTS] Change default value of the input parameter `level` for `SparkFunSuite#withLogAppender` from `None` to `Some(Level.INFO)`

This is an automated email from the ASF dual-hosted git repository.

yangjie01 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new dd925c091556 [SPARK-53168][CORE][TESTS] Change default value of the input parameter `level` for `SparkFunSuite#withLogAppender` from `None` to `Some(Level.INFO)`
dd925c091556 is described below

commit dd925c09155651c9d16f4627f1e74ed021471f11
Author: yangjie01 <ya...@baidu.com>
AuthorDate: Fri Aug 8 00:57:58 2025 +0800

    [SPARK-53168][CORE][TESTS] Change default value of the input parameter `level` for `SparkFunSuite#withLogAppender` from `None` to `Some(Level.INFO)`
    
    ### What changes were proposed in this pull request?
    This pr changes the default value of the input parameter `level: Option[Level]` for the `SparkFunSuite#withLogAppender` function from `None` to `Some(Level.INFO)`, in order to decouple the relevant tests from the `rootLogger.level` configuration in the `log4j2.properties` .
    
    ### Why are the changes needed?
    Suppose, for some reason, we change the `rootLogger.level` configuration value in `sql/core/src/test/resources/log4j2.properties` from `info` to `warn`. Subsequently, when running unit tests, failures similar to the following may occur:
    
    ```
    build/sbt clean "sql/testOnly org.apache.spark.sql.execution.QueryExecutionSuite"
    
    [info] - Logging plan changes for execution *** FAILED *** (63 milliseconds)
    [info]   testAppender.loggingEvents.exists(((x$10: org.apache.logging.log4j.core.LogEvent) => x$10.getMessage().getFormattedMessage().contains(expectedMsg))) was false (QueryExecutionSuite.scala:243)
    [info]   org.scalatest.exceptions.TestFailedException:
    ...
    ```
    
    Similar issues may also arise in other test cases such as `AdaptiveQueryExecSuite`. Therefore, this PR modifies the default value of the `level` parameter to avoid such test coupling problems.
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    - Passed Github Actions
    - Manually verified that the aforementioned test cases no longer fail
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #51895 from LuciferYang/SPARK-53168.
    
    Authored-by: yangjie01 <ya...@baidu.com>
    Signed-off-by: yangjie01 <ya...@baidu.com>
---
 core/src/test/scala/org/apache/spark/SparkFunSuite.scala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/src/test/scala/org/apache/spark/SparkFunSuite.scala b/core/src/test/scala/org/apache/spark/SparkFunSuite.scala
index 3d28bde1fb2b..cd421ba20bd7 100644
--- a/core/src/test/scala/org/apache/spark/SparkFunSuite.scala
+++ b/core/src/test/scala/org/apache/spark/SparkFunSuite.scala
@@ -274,7 +274,7 @@ abstract class SparkFunSuite
   protected def withLogAppender(
       appender: AbstractAppender,
       loggerNames: Seq[String] = Seq.empty,
-      level: Option[Level] = None)(
+      level: Option[Level] = Some(Level.INFO))(
       f: => Unit): Unit = {
     val loggers = if (loggerNames.nonEmpty) {
       loggerNames.map(LogManager.getLogger)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org