Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-11647] Attempt to reduce time/flakiness of Thriftserver CLI and SparkSubmit tests #9623

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ import org.scalatest.BeforeAndAfterEach
import org.apache.spark.SparkFunSuite
import org.apache.spark.api.r.RUtils
import org.apache.spark.deploy.SparkSubmitUtils.MavenCoordinate
import org.apache.spark.util.ResetSystemProperties

class RPackageUtilsSuite extends SparkFunSuite with BeforeAndAfterEach {
class RPackageUtilsSuite
extends SparkFunSuite
with BeforeAndAfterEach
with ResetSystemProperties {

private val main = MavenCoordinate("a", "b", "c")
private val dep1 = MavenCoordinate("a", "dep1", "c")
Expand All @@ -60,11 +64,9 @@ class RPackageUtilsSuite extends SparkFunSuite with BeforeAndAfterEach {
}
}

def beforeAll() {
System.setProperty("spark.testing", "true")
}

override def beforeEach(): Unit = {
super.beforeEach()
System.setProperty("spark.testing", "true")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the difference between having it in beforeEach and beforeAll for this specific config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's marginally easier to reason about the interaction between BeforeAndAfterEach and ResetSystemProperties.

lineBuffer.clear()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import scala.collection.mutable.ArrayBuffer

import com.google.common.base.Charsets.UTF_8
import com.google.common.io.ByteStreams
import org.scalatest.Matchers
import org.scalatest.{BeforeAndAfterEach, Matchers}
import org.scalatest.concurrent.Timeouts
import org.scalatest.time.SpanSugar._

Expand All @@ -37,10 +37,12 @@ import org.apache.spark.util.{ResetSystemProperties, Utils}
class SparkSubmitSuite
extends SparkFunSuite
with Matchers
with BeforeAndAfterEach
with ResetSystemProperties
with Timeouts {

def beforeAll() {
override def beforeEach() {
super.beforeEach()
System.setProperty("spark.testing", "true")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import scala.concurrent.{Await, Promise}
import org.apache.spark.sql.test.ProcessTestUtils.ProcessOutputCapturer

import org.apache.hadoop.hive.conf.HiveConf.ConfVars
import org.scalatest.BeforeAndAfter
import org.scalatest.BeforeAndAfterAll

import org.apache.spark.util.Utils
import org.apache.spark.{Logging, SparkFunSuite}
Expand All @@ -36,21 +36,26 @@ import org.apache.spark.{Logging, SparkFunSuite}
* A test suite for the `spark-sql` CLI tool. Note that all test cases share the same temporary
* Hive metastore and warehouse.
*/
class CliSuite extends SparkFunSuite with BeforeAndAfter with Logging {
class CliSuite extends SparkFunSuite with BeforeAndAfterAll with Logging {
val warehousePath = Utils.createTempDir()
val metastorePath = Utils.createTempDir()
val scratchDirPath = Utils.createTempDir()

before {
override def beforeAll(): Unit = {
super.beforeAll()
warehousePath.delete()
metastorePath.delete()
scratchDirPath.delete()
}

after {
warehousePath.delete()
metastorePath.delete()
scratchDirPath.delete()
override def afterAll(): Unit = {
try {
warehousePath.delete()
metastorePath.delete()
scratchDirPath.delete()
} finally {
super.afterAll()
}
}

/**
Expand Down Expand Up @@ -79,6 +84,8 @@ class CliSuite extends SparkFunSuite with BeforeAndAfter with Logging {
val jdbcUrl = s"jdbc:derby:;databaseName=$metastorePath;create=true"
s"""$cliScript
| --master local
| --driver-java-options -Dderby.system.durability=test
| --conf spark.ui.enabled=false
| --hiveconf ${ConfVars.METASTORECONNECTURLKEY}=$jdbcUrl
| --hiveconf ${ConfVars.METASTOREWAREHOUSE}=$warehousePath
| --hiveconf ${ConfVars.SCRATCHDIR}=$scratchDirPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import java.util.Date

import scala.collection.mutable.ArrayBuffer

import org.scalatest.Matchers
import org.scalatest.{BeforeAndAfterEach, Matchers}
import org.scalatest.concurrent.Timeouts
import org.scalatest.exceptions.TestFailedDueToTimeoutException
import org.scalatest.time.SpanSugar._
Expand All @@ -42,14 +42,14 @@ import org.apache.spark.util.{ResetSystemProperties, Utils}
class HiveSparkSubmitSuite
extends SparkFunSuite
with Matchers
// This test suite sometimes gets extremely slow out of unknown reason on Jenkins. Here we
// add a timestamp to provide more diagnosis information.
with BeforeAndAfterEach
with ResetSystemProperties
with Timeouts {

// TODO: rewrite these or mark them as slow tests to be run sparingly

def beforeAll() {
override def beforeEach() {
super.beforeEach()
System.setProperty("spark.testing", "true")
}

Expand All @@ -66,6 +66,7 @@ class HiveSparkSubmitSuite
"--master", "local-cluster[2,1,1024]",
"--conf", "spark.ui.enabled=false",
"--conf", "spark.master.rest.enabled=false",
"--driver-java-options", "-Dderby.system.durability=test",
"--jars", jarsString,
unusedJar.toString, "SparkSubmitClassA", "SparkSubmitClassB")
runSparkSubmit(args)
Expand All @@ -79,6 +80,7 @@ class HiveSparkSubmitSuite
"--master", "local-cluster[2,1,1024]",
"--conf", "spark.ui.enabled=false",
"--conf", "spark.master.rest.enabled=false",
"--driver-java-options", "-Dderby.system.durability=test",
unusedJar.toString)
runSparkSubmit(args)
}
Expand All @@ -93,6 +95,7 @@ class HiveSparkSubmitSuite
val args = Seq(
"--conf", "spark.ui.enabled=false",
"--conf", "spark.master.rest.enabled=false",
"--driver-java-options", "-Dderby.system.durability=test",
"--class", "Main",
testJar)
runSparkSubmit(args)
Expand All @@ -104,6 +107,9 @@ class HiveSparkSubmitSuite
"--class", SPARK_9757.getClass.getName.stripSuffix("$"),
"--name", "SparkSQLConfTest",
"--master", "local-cluster[2,1,1024]",
"--conf", "spark.ui.enabled=false",
"--conf", "spark.master.rest.enabled=false",
"--driver-java-options", "-Dderby.system.durability=test",
unusedJar.toString)
runSparkSubmit(args)
}
Expand All @@ -114,6 +120,9 @@ class HiveSparkSubmitSuite
"--class", SPARK_11009.getClass.getName.stripSuffix("$"),
"--name", "SparkSQLConfTest",
"--master", "local-cluster[2,1,1024]",
"--conf", "spark.ui.enabled=false",
"--conf", "spark.master.rest.enabled=false",
"--driver-java-options", "-Dderby.system.durability=test",
unusedJar.toString)
runSparkSubmit(args)
}
Expand Down