From d3e13064f5d165b55941630a5bd6e1d864713ed5 Mon Sep 17 00:00:00 2001 From: Andrew Wilkins Date: Fri, 8 Nov 2024 11:47:00 +0800 Subject: [PATCH] Fix testRolloverForFreshInstalledIndexTemplate (#116450) Fix IndexTemplateRegistryTests.testRolloverForFreshInstalledIndexTemplate by using assertBusy, now that we're expecting a rollover. --- .../xpack/core/template/IndexTemplateRegistryTests.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/template/IndexTemplateRegistryTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/template/IndexTemplateRegistryTests.java index 8d8aa9fd3c634..e396712cbc360 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/template/IndexTemplateRegistryTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/template/IndexTemplateRegistryTests.java @@ -475,8 +475,7 @@ public void testRolloverForFreshInstalledIndexTemplate() throws Exception { assertBusy(() -> assertThat(putIndexTemplateCounter.get(), equalTo(1))); // rollover should be triggered even for the first installation, since the template // may now take precedence over a data stream's existing index template - Thread.sleep(100L); - assertThat(rolloverCounter.get(), equalTo(2)); + assertBusy(() -> assertThat(rolloverCounter.get(), equalTo(2))); } public void testThatTemplatesAreNotUpgradedWhenNotNeeded() throws Exception {