diff --git a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java index 809b0f57f23c8..f410164faaa59 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java @@ -1444,7 +1444,16 @@ public void testDeleteActionDoesntDeleteSearchableSnapshot() throws Exception { return false; } }, 30, TimeUnit.SECONDS)); - assertBusy(() -> assertFalse(indexExists(restoredIndexName))); + + // wait for **both** the restored and the original managed index to not exist anymore + // (making sure the ILM policy finished - asserting only on the restored index has the + // problem of a fast executing test code that will have the + // `assertFalse(indexExists(restoredIndexName))` assertion pass before the restored index + // ever existed) + assertBusy(() -> { + assertFalse(indexExists(index)); + assertFalse(indexExists(restoredIndexName)); + }, 90, TimeUnit.SECONDS); assertTrue("the snapshot we generate in the cold phase should not be deleted by the delete phase", waitUntil(() -> { try {