Skip to content

Commit 673dd65

Browse files
committed
Ensure listener is done in testPendingConnectListeners
We need to ensure that we do not fail on InterruptedException in the connection listener as this can happen when the connection is closed. Closes #59879
1 parent 50fea0d commit 673dd65

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

server/src/test/java/org/elasticsearch/transport/RemoteClusterConnectionTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,6 @@ public void onFailure(Exception e) {
12061206
}
12071207
}
12081208

1209-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/59879")
12101209
public void testPendingConnectListeners() throws IOException, InterruptedException {
12111210
List<DiscoveryNode> knownNodes = new CopyOnWriteArrayList<>();
12121211
try (MockTransportService seedTransport = startTransport("seed_node", knownNodes, Version.CURRENT);
@@ -1225,6 +1224,7 @@ public void testPendingConnectListeners() throws IOException, InterruptedExcepti
12251224
ConnectionManager connectionManager = connection.getConnectionManager();
12261225
CountDownLatch connectionOpenedLatch = new CountDownLatch(1);
12271226
CountDownLatch connectionBlockedLatch = new CountDownLatch(1);
1227+
CountDownLatch completionLatch = new CountDownLatch(1);
12281228
connectionManager.addListener(new TransportConnectionListener() {
12291229
@Override
12301230
public void onConnectionOpened(Transport.Connection connection) {
@@ -1233,6 +1233,8 @@ public void onConnectionOpened(Transport.Connection connection) {
12331233
connectionBlockedLatch.await();
12341234
} catch (InterruptedException e) {
12351235
throw new AssertionError(e);
1236+
} finally {
1237+
completionLatch.countDown();
12361238
}
12371239
}
12381240
});
@@ -1261,6 +1263,7 @@ public void onFailure(Exception e) {
12611263
}
12621264
} finally {
12631265
connectionBlockedLatch.countDown();
1266+
completionLatch.await();
12641267
thread.join();
12651268
}
12661269
}

0 commit comments

Comments
 (0)