Skip to content

Commit d451f98

Browse files
committed
[SPARK-25337][SQL] runSparkSubmit should provide non-testing mode
1 parent 2119e51 commit d451f98

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveExternalCatalogVersionsSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class HiveExternalCatalogVersionsSuite extends SparkSubmitTestUtils {
181181
"--conf", s"spark.sql.test.version.index=$index",
182182
"--driver-java-options", s"-Dderby.system.home=${wareHousePath.getCanonicalPath}",
183183
tempPyFile.getCanonicalPath)
184-
runSparkSubmit(args, Some(sparkHome.getCanonicalPath))
184+
runSparkSubmit(args, Some(sparkHome.getCanonicalPath), false)
185185
}
186186

187187
tempPyFile.delete()

sql/hive/src/test/scala/org/apache/spark/sql/hive/SparkSubmitTestUtils.scala

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ trait SparkSubmitTestUtils extends SparkFunSuite with TimeLimits {
3838

3939
// NOTE: This is an expensive operation in terms of time (10 seconds+). Use sparingly.
4040
// This is copied from org.apache.spark.deploy.SparkSubmitSuite
41-
protected def runSparkSubmit(args: Seq[String], sparkHomeOpt: Option[String] = None): Unit = {
41+
protected def runSparkSubmit(
42+
args: Seq[String],
43+
sparkHomeOpt: Option[String] = None,
44+
isSparkTesting: Boolean = true): Unit = {
4245
val sparkHome = sparkHomeOpt.getOrElse(
4346
sys.props.getOrElse("spark.test.home", fail("spark.test.home is not set!")))
4447
val history = ArrayBuffer.empty[String]
@@ -53,7 +56,14 @@ trait SparkSubmitTestUtils extends SparkFunSuite with TimeLimits {
5356

5457
val builder = new ProcessBuilder(commands: _*).directory(new File(sparkHome))
5558
val env = builder.environment()
56-
env.put("SPARK_TESTING", "1")
59+
if (isSparkTesting) {
60+
env.put("SPARK_TESTING", "1")
61+
} else {
62+
env.remove("SPARK_TESTING")
63+
env.remove("SPARK_SQL_TESTING")
64+
env.remove("SPARK_PREPEND_CLASSES")
65+
env.remove("SPARK_DIST_CLASSPATH")
66+
}
5767
env.put("SPARK_HOME", sparkHome)
5868

5969
def captureOutput(source: String)(line: String): Unit = {

0 commit comments

Comments
 (0)