From 101c5b8612cea2fbc78b507805ee69ec4fb5d36b Mon Sep 17 00:00:00 2001 From: Andrei Dan Date: Tue, 2 Feb 2021 15:44:23 +0000 Subject: [PATCH] Fix testDeleteActionDoesntDeleteSearchableSnapshot (#68376) (cherry picked from commit 4ce4a128a712534822aec3ad9845a5dd63608039) Signed-off-by: Andrei Dan --- .../xpack/ilm/TimeSeriesLifecycleActionsIT.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 3d32352bd5571..b56049f2fd2f8 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 @@ -1454,7 +1454,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 {