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

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


The following commit(s) were added to refs/heads/master by this push:
     new 886e1ee3 [AURON #1757] Add cleanup logic to prevent flaky tests caused 
by leftover locations (#1758)
886e1ee3 is described below

commit 886e1ee36fa3dfb8ddb0dafde679bab3363971bd
Author: yew1eb <[email protected]>
AuthorDate: Wed Jan 28 00:09:38 2026 +0800

    [AURON #1757] Add cleanup logic to prevent flaky tests caused by leftover 
locations (#1758)
    
    <!--
    - Start the PR title with the related issue ID, e.g. '[AURON #XXXX]
    Short summary...'.
    -->
    # Which issue does this PR close?
    
    Closes #1757
    
    # Rationale for this change
    
    # What changes are included in this PR?
    BaseAuronSQLSuite: reset suite workspace and set spark.sql.warehouse.dir
    
    # Are there any user-facing changes?
    
    # How was this patch tested?
---
 .../scala/org/apache/auron/BaseAuronSQLSuite.scala | 29 +++++++++++++++++++++-
 .../sql/execution/BuildInfoInSparkUISuite.scala    |  4 +--
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git 
a/spark-extension-shims-spark/src/test/scala/org/apache/auron/BaseAuronSQLSuite.scala
 
b/spark-extension-shims-spark/src/test/scala/org/apache/auron/BaseAuronSQLSuite.scala
index 75ed44fb..315d4aab 100644
--- 
a/spark-extension-shims-spark/src/test/scala/org/apache/auron/BaseAuronSQLSuite.scala
+++ 
b/spark-extension-shims-spark/src/test/scala/org/apache/auron/BaseAuronSQLSuite.scala
@@ -16,10 +16,37 @@
  */
 package org.apache.auron
 
+import java.io.File
+
+import org.apache.commons.io.FileUtils
 import org.apache.spark.SparkConf
 import org.apache.spark.sql.test.SharedSparkSession
 
 trait BaseAuronSQLSuite extends SharedSparkSession {
+  protected val suiteWorkspace: String = getClass.getResource("/").getPath + 
"auron-tests-workdir"
+  protected val warehouseDir: String = suiteWorkspace + "/spark-warehouse"
+  protected val metastoreDir: String = suiteWorkspace + "/meta"
+
+  protected def resetSuiteWorkspace(): Unit = {
+    val workdir = new File(suiteWorkspace)
+    if (workdir.exists()) {
+      FileUtils.forceDelete(workdir)
+    }
+    FileUtils.forceMkdir(workdir)
+    FileUtils.forceMkdir(new File(warehouseDir))
+    FileUtils.forceMkdir(new File(metastoreDir))
+  }
+
+  override def beforeAll(): Unit = {
+    // Prepare a clean workspace before SparkSession initialization
+    resetSuiteWorkspace()
+    super.beforeAll()
+    spark.sparkContext.setLogLevel("WARN")
+  }
+
+  override def afterAll(): Unit = {
+    super.afterAll()
+  }
 
   override protected def sparkConf: SparkConf = {
     super.sparkConf
@@ -30,6 +57,6 @@ trait BaseAuronSQLSuite extends SharedSparkSession {
       .set("spark.memory.offHeap.enabled", "false")
       .set("spark.auron.enable", "true")
       .set("spark.ui.enabled", "false")
+      .set("spark.sql.warehouse.dir", warehouseDir)
   }
-
 }
diff --git 
a/spark-extension-shims-spark/src/test/scala/org/apache/spark/sql/execution/BuildInfoInSparkUISuite.scala
 
b/spark-extension-shims-spark/src/test/scala/org/apache/spark/sql/execution/BuildInfoInSparkUISuite.scala
index e030f895..864879f1 100644
--- 
a/spark-extension-shims-spark/src/test/scala/org/apache/spark/sql/execution/BuildInfoInSparkUISuite.scala
+++ 
b/spark-extension-shims-spark/src/test/scala/org/apache/spark/sql/execution/BuildInfoInSparkUISuite.scala
@@ -33,12 +33,12 @@ class BuildInfoInSparkUISuite extends AuronQueryTest with 
BaseAuronSQLSuite {
     super.sparkConf.set("spark.eventLog.dir", testDir.toString)
   }
 
-  override protected def beforeAll(): Unit = {
+  override def beforeAll(): Unit = {
     testDir = Utils.createTempDir(namePrefix = "spark-events")
     super.beforeAll()
   }
 
-  override protected def afterAll(): Unit = {
+  override def afterAll(): Unit = {
     Utils.deleteRecursively(testDir)
   }
 

Reply via email to