Skip to content

Commit 2b5ca06

Browse files
author
Marcelo Vanzin
committed
[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.
1 parent bc8d093 commit 2b5ca06

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

launcher/src/test/java/org/apache/spark/launcher/LauncherServerSuite.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,14 @@ public void testAppHandleDisconnect() throws Exception {
196196
Socket s = new Socket(InetAddress.getLoopbackAddress(), server.getPort());
197197
client = new TestClient(s);
198198
client.send(new Hello(secret, "1.4.0"));
199+
client.send(new SetAppId("someId"));
200+
201+
// Wait until we know the server has received the messages and matched the handle to the
202+
// connection before disconnecting.
203+
eventually(Duration.ofSeconds(1), Duration.ofMillis(10), () -> {
204+
assertEquals("someId", handle.getAppId());
205+
});
206+
199207
handle.disconnect();
200208
waitForError(client, secret);
201209
} finally {

0 commit comments

Comments
 (0)