Skip to content
Snippets Groups Projects
Commit 7138816a authored by Hari Shreedharan's avatar Hari Shreedharan Committed by Andrew Or
Browse files

[SPARK-5937][YARN] Fix ClientSuite to set YARN mode, so that the correct class is used in t...

...ests.

Without this SparkHadoopUtil is used by the Client instead of YarnSparkHadoopUtil.

Author: Hari Shreedharan <hshreedharan@apache.org>

Closes #4711 from harishreedharan/SPARK-5937 and squashes the following commits:

d154de6 [Hari Shreedharan] Use System.clearProperty() instead of setting the value of SPARK_YARN_MODE to empty string.
f729f70 [Hari Shreedharan] Fix ClientSuite to set YARN mode, so that the correct class is used in tests.
parent d3cbd38c
No related branches found
No related tags found
No related merge requests found
...@@ -28,8 +28,7 @@ import org.apache.hadoop.yarn.api.records._ ...@@ -28,8 +28,7 @@ import org.apache.hadoop.yarn.api.records._
import org.apache.hadoop.yarn.conf.YarnConfiguration import org.apache.hadoop.yarn.conf.YarnConfiguration
import org.mockito.Matchers._ import org.mockito.Matchers._
import org.mockito.Mockito._ import org.mockito.Mockito._
import org.scalatest.FunSuite import org.scalatest.{BeforeAndAfterAll, FunSuite, Matchers}
import org.scalatest.Matchers
import scala.collection.JavaConversions._ import scala.collection.JavaConversions._
import scala.collection.mutable.{ HashMap => MutableHashMap } import scala.collection.mutable.{ HashMap => MutableHashMap }
...@@ -39,7 +38,15 @@ import scala.util.Try ...@@ -39,7 +38,15 @@ import scala.util.Try
import org.apache.spark.{SparkException, SparkConf} import org.apache.spark.{SparkException, SparkConf}
import org.apache.spark.util.Utils import org.apache.spark.util.Utils
class ClientSuite extends FunSuite with Matchers { class ClientSuite extends FunSuite with Matchers with BeforeAndAfterAll {
override def beforeAll(): Unit = {
System.setProperty("SPARK_YARN_MODE", "true")
}
override def afterAll(): Unit = {
System.clearProperty("SPARK_YARN_MODE")
}
test("default Yarn application classpath") { test("default Yarn application classpath") {
Client.getDefaultYarnApplicationClasspath should be(Some(Fixtures.knownDefYarnAppCP)) Client.getDefaultYarnApplicationClasspath should be(Some(Fixtures.knownDefYarnAppCP))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment