TESTS: Fix Random Fail in MockTcpTransportTests (#33061)
* `foobar.txGet()` appears to return before `serviceB.stop()` returns, causing `ServiceB.close()` to run concurrently with the `stop` call and running into a race codition * Closes #32863
This commit is contained in:
parent
61f5c188e0
commit
917e5a8c94
|
@ -768,6 +768,7 @@ public abstract class AbstractSimpleTransportTestCase extends ESTestCase {
|
|||
|
||||
public void testNotifyOnShutdown() throws Exception {
|
||||
final CountDownLatch latch2 = new CountDownLatch(1);
|
||||
final CountDownLatch latch3 = new CountDownLatch(1);
|
||||
try {
|
||||
serviceA.registerRequestHandler("internal:foobar", StringMessageRequest::new, ThreadPool.Names.GENERIC,
|
||||
(request, channel, task) -> {
|
||||
|
@ -777,6 +778,8 @@ public abstract class AbstractSimpleTransportTestCase extends ESTestCase {
|
|||
serviceB.stop();
|
||||
} catch (Exception e) {
|
||||
fail(e.getMessage());
|
||||
} finally {
|
||||
latch3.countDown();
|
||||
}
|
||||
});
|
||||
TransportFuture<TransportResponse.Empty> foobar = serviceB.submitRequest(nodeA, "internal:foobar",
|
||||
|
@ -788,6 +791,7 @@ public abstract class AbstractSimpleTransportTestCase extends ESTestCase {
|
|||
} catch (TransportException ex) {
|
||||
|
||||
}
|
||||
latch3.await();
|
||||
} finally {
|
||||
serviceB.close(); // make sure we are fully closed here otherwise we might run into assertions down the road
|
||||
serviceA.disconnectFromNode(nodeB);
|
||||
|
|
Loading…
Reference in New Issue