Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the index version compatible test to only check the minimum #120406

Merged
merged 3 commits into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

package org.elasticsearch.test.index;

import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.IndexVersions;
import org.elasticsearch.test.ESTestCase;

Expand All @@ -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<IndexVersion> 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<String> 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));
}

/**
Expand Down