Skip to content

Commit

Permalink
[SPARK-6980] Changed UT ask message timeout to explicitly intercept a…
Browse files Browse the repository at this point in the history
… SparkException
  • Loading branch information
BryanCutler committed Jun 23, 2015
1 parent 1394de6 commit c6cfd33
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,14 @@ abstract class RpcEnvSuite extends SparkFunSuite with BeforeAndAfterAll {
// Use anotherEnv to find out the RpcEndpointRef
val rpcEndpointRef = anotherEnv.setupEndpointRef("local", env.address, "ask-timeout")
try {
val e = intercept[Exception] {
// Any exception thrown in askWithRetry is wrapped with a SparkException and set as the cause
val e = intercept[SparkException] {
rpcEndpointRef.askWithRetry[String]("hello", new RpcTimeout(1 millis, shortProp))
}
assert(e.isInstanceOf[TimeoutException] || e.getCause.isInstanceOf[TimeoutException])
e match {
case te: TimeoutException =>
assert(te.getMessage().contains(shortProp))
case e: Exception =>
assert(e.getCause().getMessage().contains(shortProp))
}
// The SparkException cause should be a RpcTimeoutException with message indicating the
// controlling timeout property
assert(e.getCause.isInstanceOf[RpcTimeoutException])
assert(e.getCause().getMessage().contains(shortProp))
} finally {
anotherEnv.shutdown()
anotherEnv.awaitTermination()
Expand Down

0 comments on commit c6cfd33

Please sign in to comment.