Github user szyszy commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20761#discussion_r187808559
  
    --- Diff: 
resource-managers/yarn/src/test/scala/org/apache/spark/deploy/yarn/ClientSuite.scala
 ---
    @@ -35,17 +36,23 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration
     import org.apache.hadoop.yarn.util.Records
     import org.mockito.Matchers.{eq => meq, _}
     import org.mockito.Mockito._
    -import org.scalatest.Matchers
    +import org.scalatest.{BeforeAndAfterAll, Matchers}
     
     import org.apache.spark.{SparkConf, SparkFunSuite, TestUtils}
     import org.apache.spark.deploy.yarn.config._
     import org.apache.spark.util.{SparkConfWithEnv, Utils}
     
    -class ClientSuite extends SparkFunSuite with Matchers {
    +class ClientSuite extends SparkFunSuite with Matchers with 
BeforeAndAfterAll {
     
       import Client._
     
       var oldSystemProperties: Properties = null
    +  private var yarnResourceTypesAvailable = false
    +
    +  override def beforeAll(): Unit = {
    +    super.beforeAll()
    +    yarnResourceTypesAvailable = 
ResourceTypeHelper.isYarnResourceTypesAvailable()
    --- End diff --
    
    I agree it’s more concise to inline, my first intention was to save it to 
a variable so then no subsequent calls should be made to that method since it 
uses reflection to check whether the ResourceInformation class is available.
    Anyway, I inlined all the occurences in the test methods.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to