Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Loading