From b70b474abeccaf54b952904d3a6cf0c047be7a68 Mon Sep 17 00:00:00 2001 From: Aurelien FOUCRET Date: Thu, 7 Mar 2024 11:49:05 +0100 Subject: [PATCH] Fix version check --- .../xpack/application/FullClusterRestartIT.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/x-pack/plugin/ent-search/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/xpack/application/FullClusterRestartIT.java b/x-pack/plugin/ent-search/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/xpack/application/FullClusterRestartIT.java index 7ba036f6f8c0f..95b3b576eb46c 100644 --- a/x-pack/plugin/ent-search/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/xpack/application/FullClusterRestartIT.java +++ b/x-pack/plugin/ent-search/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/xpack/application/FullClusterRestartIT.java @@ -23,6 +23,7 @@ import java.util.List; import static org.elasticsearch.Version.V_8_12_0; +import static org.hamcrest.Matchers.greaterThanOrEqualTo; public class FullClusterRestartIT extends ParameterizedFullClusterRestartTestCase { // DSL was introduced with version 8.12.0 of ES. @@ -67,7 +68,7 @@ public void testBehavioralAnalyticsDataRetention() throws Exception { if (isRunningAgainstOldCluster()) { // Ensure index template is installed before executing the tests. - assertBusy(() -> assertDataStreamTemplateExists(EVENT_DATA_STREAM_TEMPLATE_NAME)); + assertBusy(() -> assertDataStreamTemplateExists(EVENT_DATA_STREAM_LEGACY_TEMPLATE_NAME)); // Create an analytics collection Request legacyPutRequest = new Request("PUT", "_application/analytics/" + legacyAnalyticsCollectionName); @@ -77,7 +78,7 @@ public void testBehavioralAnalyticsDataRetention() throws Exception { assertBusy(() -> assertUsingLegacyDataRetentionPolicy(legacyAnalyticsCollectionName)); } else { // Ensure index template is updated to version 3 before executing the tests. - assertBusy(() -> assertDataStreamTemplateExists(EVENT_DATA_STREAM_TEMPLATE_NAME, DSL_REGISTRY_VERSION)); + assertBusy(() -> assertDataStreamTemplateExists(EVENT_DATA_STREAM_LEGACY_TEMPLATE_NAME, DSL_REGISTRY_VERSION)); // Create a new analytics collection Request putRequest = new Request("PUT", "_application/analytics/" + newAnalyticsCollectionName); @@ -140,7 +141,7 @@ private void assertDataStreamTemplateExists(String templateName, Integer minVers if (minVersion != null) { String pathToVersion = "index_templates.0.index_template.version"; ObjectPath indexTemplatesResponse = ObjectPath.createFromResponse(response); - assertEquals(minVersion, indexTemplatesResponse.evaluate(pathToVersion)); + assertThat(indexTemplatesResponse.evaluate(pathToVersion), greaterThanOrEqualTo(minVersion)); } } catch (ResponseException e) { int status = e.getResponse().getStatusLine().getStatusCode();