From 787a16d0d5f01502b1d73f649d7d9f15de9d8c69 Mon Sep 17 00:00:00 2001 From: Simon Cooper Date: Thu, 23 Jan 2025 15:59:19 +0000 Subject: [PATCH] Update the index version compatible test to only check the minimum (#120406) --- .../test/index/IndexVersionUtilsTests.java | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/test/framework/src/test/java/org/elasticsearch/test/index/IndexVersionUtilsTests.java b/test/framework/src/test/java/org/elasticsearch/test/index/IndexVersionUtilsTests.java index 53758c165a3c7..05e8a93ad99ed 100644 --- a/test/framework/src/test/java/org/elasticsearch/test/index/IndexVersionUtilsTests.java +++ b/test/framework/src/test/java/org/elasticsearch/test/index/IndexVersionUtilsTests.java @@ -9,7 +9,6 @@ package org.elasticsearch.test.index; -import org.elasticsearch.index.IndexVersion; import org.elasticsearch.index.IndexVersions; import org.elasticsearch.test.ESTestCase; @@ -19,26 +18,19 @@ import java.util.List; import java.util.Set; +import static org.hamcrest.Matchers.equalTo; + public class IndexVersionUtilsTests extends ESTestCase { /** * Tests that {@link IndexVersions#MINIMUM_COMPATIBLE} and {@link IndexVersionUtils#allReleasedVersions()} - * agree with the list of index compatible versions we build in gradle. + * agree on the minimum version that should be tested. */ - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/98054") - public void testGradleVersionsMatchVersionUtils() { + public void testIndexCompatibleVersionMatches() { VersionsFromProperty indexCompatible = new VersionsFromProperty("tests.gradle_index_compat_versions"); - List released = IndexVersionUtils.allReleasedVersions() - .stream() - /* Java lists all versions from the 5.x series onwards, but we only want to consider - * ones that we're supposed to be compatible with. */ - .filter(v -> v.onOrAfter(IndexVersions.MINIMUM_COMPATIBLE)) - .toList(); - List releasedIndexCompatible = released.stream() - .filter(v -> IndexVersion.current().equals(v) == false) - .map(Object::toString) - .toList(); - assertEquals(releasedIndexCompatible, indexCompatible.released); + String minIndexVersion = IndexVersions.MINIMUM_COMPATIBLE.toReleaseVersion(); + String lowestCompatibleVersion = indexCompatible.released.get(0); + assertThat(lowestCompatibleVersion, equalTo(minIndexVersion)); } /**