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 1d70b2a03b7bb..d4dd2a71e311a 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 @@ -1447,7 +1447,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 {