Repository: spark
Updated Branches:
  refs/heads/master a7c19d9c2 -> 28ea4e314


[SPARK-23834][TEST] Wait for connection before disconnect in LauncherServer 
test.

It was possible that the disconnect() was called on the handle before the
server had received the handshake messages, so no connection was yet
attached to the handle. The fix waits until we're sure the handle has been
mapped to a client connection.

Author: Marcelo Vanzin <van...@cloudera.com>

Closes #20950 from vanzin/SPARK-23834.


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

Branch: refs/heads/master
Commit: 28ea4e3142b88eb396aa8dd5daf7b02b556204ba
Parents: a7c19d9
Author: Marcelo Vanzin <van...@cloudera.com>
Authored: Mon Apr 2 14:35:07 2018 -0700
Committer: Marcelo Vanzin <van...@cloudera.com>
Committed: Mon Apr 2 14:35:07 2018 -0700

----------------------------------------------------------------------
 .../java/org/apache/spark/launcher/LauncherServerSuite.java  | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/28ea4e31/launcher/src/test/java/org/apache/spark/launcher/LauncherServerSuite.java
----------------------------------------------------------------------
diff --git 
a/launcher/src/test/java/org/apache/spark/launcher/LauncherServerSuite.java 
b/launcher/src/test/java/org/apache/spark/launcher/LauncherServerSuite.java
index 5413d3a..f8dc0ec 100644
--- a/launcher/src/test/java/org/apache/spark/launcher/LauncherServerSuite.java
+++ b/launcher/src/test/java/org/apache/spark/launcher/LauncherServerSuite.java
@@ -196,6 +196,14 @@ public class LauncherServerSuite extends BaseSuite {
       Socket s = new Socket(InetAddress.getLoopbackAddress(), 
server.getPort());
       client = new TestClient(s);
       client.send(new Hello(secret, "1.4.0"));
+      client.send(new SetAppId("someId"));
+
+      // Wait until we know the server has received the messages and matched 
the handle to the
+      // connection before disconnecting.
+      eventually(Duration.ofSeconds(1), Duration.ofMillis(10), () -> {
+        assertEquals("someId", handle.getAppId());
+      });
+
       handle.disconnect();
       waitForError(client, secret);
     } finally {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to