diff --git a/server/src/test/java/org/elasticsearch/action/support/ListenableActionFutureTests.java b/server/src/test/java/org/elasticsearch/action/support/ListenableActionFutureTests.java index 1ebd7fab99f9e..a9f62d0e439e8 100644 --- a/server/src/test/java/org/elasticsearch/action/support/ListenableActionFutureTests.java +++ b/server/src/test/java/org/elasticsearch/action/support/ListenableActionFutureTests.java @@ -68,7 +68,6 @@ protected void doRun() { } } - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/68772") public void testListenersNotifiedOnCorrectThreads() throws InterruptedException { final int adderThreads = between(1, 5); @@ -90,7 +89,10 @@ public void testListenersNotifiedOnCorrectThreads() throws InterruptedException awaitSafe(barrier); final AtomicBoolean isComplete = new AtomicBoolean(); - if (postComplete.get()) { + if (completerThreads == 1 && postComplete.get()) { + // If there are multiple completer threads then onResponse might return on one thread, and hence postComplete is + // set, before the other completer thread notifies all the listeners. OTOH with one completer thread we know that + // postComplete indicates that the listeners were already notified. future.addListener(new ActionListener() { @Override public void onResponse(Void response) {