Repository: spark
Updated Branches:
  refs/heads/master 847efe126 -> 9be794586


[SPARK-21006][TESTS] Create rpcEnv and run later needs shutdown and 
awaitTermination

Signed-off-by: 10087686 <wang.jiaochunzte.com.cn>

## What changes were proposed in this pull request?
When  run test("port conflict") case, we need run anotherEnv.shutdown() and 
anotherEnv.awaitTermination() for free resource.
(Please fill in changes proposed in this fix)

## How was this patch tested?
run RpcEnvSuit.scala Utest
(Please explain how this patch was tested. E.g. unit tests, integration tests, 
manual tests)
(If this patch involves UI changes, please attach a screenshot; otherwise, 
remove this)

Please review http://spark.apache.org/contributing.html before opening a pull 
request.

Author: 10087686 <[email protected]>

Closes #18226 from wangjiaochun/master.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/9be79458
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/9be79458
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/9be79458

Branch: refs/heads/master
Commit: 9be7945861a39974172826fc2d27ba8f5b8c3827
Parents: 847efe1
Author: 10087686 <[email protected]>
Authored: Thu Jun 8 10:58:09 2017 +0100
Committer: Sean Owen <[email protected]>
Committed: Thu Jun 8 10:58:09 2017 +0100

----------------------------------------------------------------------
 core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/9be79458/core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala 
b/core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala
index 31d9dd3..59d8c14 100644
--- a/core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala
+++ b/core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala
@@ -633,7 +633,12 @@ abstract class RpcEnvSuite extends SparkFunSuite with 
BeforeAndAfterAll {
 
   test("port conflict") {
     val anotherEnv = createRpcEnv(new SparkConf(), "remote", env.address.port)
-    assert(anotherEnv.address.port != env.address.port)
+    try {
+      assert(anotherEnv.address.port != env.address.port)
+    } finally {
+      anotherEnv.shutdown()
+      anotherEnv.awaitTermination()
+    }
   }
 
   private def testSend(conf: SparkConf): Unit = {


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

Reply via email to