diff --git a/server/src/test/java/org/elasticsearch/transport/RemoteClusterAwareClientTests.java b/server/src/test/java/org/elasticsearch/transport/RemoteClusterAwareClientTests.java index 7f355f7cb90dc..059a154e6b7de 100644 --- a/server/src/test/java/org/elasticsearch/transport/RemoteClusterAwareClientTests.java +++ b/server/src/test/java/org/elasticsearch/transport/RemoteClusterAwareClientTests.java @@ -150,7 +150,13 @@ public void testRemoteTaskCancellationOnFailedResponse() throws Exception { // assert remote task is cancelled assertBusy(cancelChildSent::get); assertBusy(cancelChildReceived::get); - verify(remoteTransport.getTaskManager()).cancelChildLocal(eq(parentTaskId), eq(searchShardsRequestId.get()), anyString()); + assertBusy( + () -> verify(remoteTransport.getTaskManager()).cancelChildLocal( + eq(parentTaskId), + eq(searchShardsRequestId.get()), + anyString() + ) + ); } } }