File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
core/src/test/scala/org/apache/spark/rpc Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -162,16 +162,14 @@ abstract class RpcEnvSuite extends SparkFunSuite with BeforeAndAfterAll {
162162 // Use anotherEnv to find out the RpcEndpointRef
163163 val rpcEndpointRef = anotherEnv.setupEndpointRef(" local" , env.address, " ask-timeout" )
164164 try {
165- val e = intercept[Exception ] {
165+ // Any exception thrown in askWithRetry is wrapped with a SparkException and set as the cause
166+ val e = intercept[SparkException ] {
166167 rpcEndpointRef.askWithRetry[String ](" hello" , new RpcTimeout (1 millis, shortProp))
167168 }
168- assert(e.isInstanceOf [TimeoutException ] || e.getCause.isInstanceOf [TimeoutException ])
169- e match {
170- case te : TimeoutException =>
171- assert(te.getMessage().contains(shortProp))
172- case e : Exception =>
173- assert(e.getCause().getMessage().contains(shortProp))
174- }
169+ // The SparkException cause should be a RpcTimeoutException with message indicating the
170+ // controlling timeout property
171+ assert(e.getCause.isInstanceOf [RpcTimeoutException ])
172+ assert(e.getCause().getMessage().contains(shortProp))
175173 } finally {
176174 anotherEnv.shutdown()
177175 anotherEnv.awaitTermination()
You can’t perform that action at this time.
0 commit comments