Skip to content

Commit d282d7a

Browse files
Fix ClientSuite to set YARN mode, so that the correct class is used in tests.
1 parent bcfc374 commit d282d7a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

yarn/src/test/scala/org/apache/spark/deploy/yarn/ClientSuite.scala

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ import org.apache.hadoop.yarn.api.records._
2828
import org.apache.hadoop.yarn.conf.YarnConfiguration
2929
import org.mockito.Matchers._
3030
import org.mockito.Mockito._
31-
import org.scalatest.FunSuite
32-
import org.scalatest.Matchers
31+
import org.scalatest.{BeforeAndAfterAll, BeforeAndAfter, FunSuite, Matchers}
3332

3433
import scala.collection.JavaConversions._
3534
import scala.collection.mutable.{ HashMap => MutableHashMap }
@@ -39,7 +38,15 @@ import scala.util.Try
3938
import org.apache.spark.{SparkException, SparkConf}
4039
import org.apache.spark.util.Utils
4140

42-
class ClientSuite extends FunSuite with Matchers {
41+
class ClientSuite extends FunSuite with Matchers with BeforeAndAfterAll {
42+
43+
override def beforeAll(): Unit = {
44+
System.setProperty("SPARK_YARN_MODE", "true")
45+
}
46+
47+
override def afterAll(): Unit = {
48+
System.setProperty("SPARK_YARN_MODE", "")
49+
}
4350

4451
test("default Yarn application classpath") {
4552
Client.getDefaultYarnApplicationClasspath should be(Some(Fixtures.knownDefYarnAppCP))

0 commit comments

Comments
 (0)