Skip to content

Commit 7805c33

Browse files
scwfliancheng
authored andcommitted
reset SPARK_TESTING to avoid loading Log4J configurations in testing class paths
1 parent af2b5a9 commit 7805c33

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2Suite.scala

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import java.sql.{DriverManager, Statement}
2323
import java.util.concurrent.TimeoutException
2424

2525
import scala.collection.mutable.ArrayBuffer
26-
import scala.collection.JavaConversions._
2726
import scala.concurrent.duration._
2827
import scala.concurrent.{Await, Promise}
2928
import scala.sys.process.{Process, ProcessLogger}
@@ -43,11 +42,6 @@ class HiveThriftServer2Suite extends FunSuite with Logging {
4342
Class.forName(classOf[HiveDriver].getCanonicalName)
4443

4544
val verbose = Option(System.getenv("SPARK_SQL_TEST_VERBOSE")).isDefined
46-
// Since we use info to assert server process started successfully,
47-
// make sure that log4j level is INFO
48-
org.apache.log4j.LogManager.getCurrentLoggers.foreach { log =>
49-
log.asInstanceOf[org.apache.log4j.Logger].setLevel(org.apache.log4j.Level.INFO)
50-
}
5145

5246
def startThriftServerWithin(timeout: FiniteDuration = 1.minute)(f: Statement => Unit) {
5347
Thread.sleep(5000)
@@ -100,8 +94,8 @@ class HiveThriftServer2Suite extends FunSuite with Logging {
10094
.run(ProcessLogger(captureLogOutput, _ => ()))
10195
}
10296
}
103-
104-
Process(command).run(ProcessLogger(
97+
// reset SPARK_TESTING to avoid loading Log4J configurations in testing class paths
98+
Process(command, None, ("SPARK_TESTING", "0")).run(ProcessLogger(
10599
captureThriftServerOutput("stdout"),
106100
captureThriftServerOutput("stderr")))
107101

0 commit comments

Comments
 (0)