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

Only track released versions in oldVersions. #13096

Merged
merged 3 commits into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
Expand Down Expand Up @@ -61,8 +62,7 @@ public abstract class BackwardsCompatibilityTestBase extends LuceneTestCase {
"8.7.0", "8.7.0", "8.8.0", "8.8.0", "8.8.1", "8.8.1", "8.8.2", "8.8.2", "8.9.0", "8.9.0",
"8.10.0", "8.10.0", "8.10.1", "8.10.1", "8.11.0", "8.11.0", "8.11.1", "8.11.1", "8.11.2",
"8.11.2", "8.11.3", "8.11.3", "9.0.0", "9.1.0", "9.2.0", "9.3.0", "9.4.0", "9.4.1",
"9.4.2", "9.5.0", "9.6.0", "9.7.0", "9.8.0", "9.9.0", "9.9.1", "9.9.2", "9.10.0",
"10.0.0",
"9.4.2", "9.5.0", "9.6.0", "9.7.0", "9.8.0", "9.9.0", "9.9.1", "9.9.2"
};

Set<Version> binaryVersions = new HashSet<>();
Expand All @@ -75,8 +75,8 @@ public abstract class BackwardsCompatibilityTestBase extends LuceneTestCase {
throw new RuntimeException(ex);
}
}
List<Version> allCurrentVersions = getAllCurrentVersions();
for (Version version : allCurrentVersions) {

for (Version version : getAllCurrentReleasedVersions()) {
// make sure we never miss a version.
assertTrue("Version: " + version + " missing", binaryVersions.remove(version));
}
Expand Down Expand Up @@ -181,19 +181,54 @@ public static List<Version> getAllCurrentVersions() {
return versions;
}

private static List<Version> getAllCurrentReleasedVersions() {
List<Version> currentReleasedVersions = getAllCurrentVersions();

// The latest version from the current major is always under development.
assertTrue(currentReleasedVersions.remove(Version.LATEST));
if (Version.LATEST.minor == 0 && Version.LATEST.bugfix == 0) {
// If the current branch points to the next major, then the latest minor from the previous
// major is also under development.
assertTrue(currentReleasedVersions.remove(LATEST_PREVIOUS_MAJOR));
}

// In addition to those, we may need to remove one more version in case a release is in
// progress, and the version constant has been added but backward-compatibility indexes have not
// been checked in yet.
List<Version> missingVersions = new ArrayList<>();
for (Iterator<Version> it = currentReleasedVersions.iterator(); it.hasNext(); ) {
Version version = it.next();
String indexName = String.format(Locale.ROOT, "index.%s-cfs.zip", version);
if (TestAncientIndicesCompatibility.class.getResource(indexName) == null) {
missingVersions.add(version);
it.remove();
}
}

if (missingVersions.size() > 1) {
throw new AssertionError(
"More than one version is missing backward-compatibility data: " + missingVersions);
}
return currentReleasedVersions;
}

/** Get all versions that are released, plus the latest version which is unreleased. */
public static List<Version> getAllCurrentReleasedVersionsAndCurrent() {
List<Version> versions = new ArrayList<>(getAllCurrentReleasedVersions());
versions.add(Version.LATEST);
return versions;
}

public static Iterable<Object[]> allVersion(String name, String... suffixes) {
List<Object> patterns = new ArrayList<>();
for (String suffix : suffixes) {
patterns.add(createPattern(name, suffix));
}
List<Object[]> versionAndPatterns = new ArrayList<>();
List<Version> versionList = getAllCurrentVersions();
List<Version> versionList = getAllCurrentReleasedVersionsAndCurrent();
for (Version v : versionList) {
if (v.equals(LATEST_PREVIOUS_MAJOR)
== false) { // the latest prev-major has not yet been released
for (Object p : patterns) {
versionAndPatterns.add(new Object[] {v, p});
}
for (Object p : patterns) {
versionAndPatterns.add(new Object[] {v, p});
}
}
return versionAndPatterns;
Expand Down