Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[SPARK-23834][test] Wait for connection before disconnect in Launcher…
…Server 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.
  • Loading branch information
Marcelo Vanzin committed Mar 30, 2018
commit 2b5ca062cbb9035713ebb975df2949e40a9a0ef2
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ public void testAppHandleDisconnect() throws Exception {
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 {
Expand Down