Skip to content

Commit f31b02a

Browse files
committed
[Tests] Include maintenance in BwC unreleased versions
We don't support upgrades between versions further than 1 major. This change filters out these versions (e.g., 7.x from 9.x branches) from being used by BwC tests. It is necessary to correctly calculate the maintained versions from the perspective of the current branch.
1 parent 17c6e10 commit f31b02a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/BwcVersions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ private Map<Version, UnreleasedVersionInfo> computeUnreleased(List<String> devel
162162
// Now handle all the feature freeze branches
163163
List<String> featureFreezeBranches = developmentBranches.stream()
164164
.filter(b -> Pattern.matches("[0-9]+\\.[0-9]+", b))
165+
.filter(b -> currentVersion.getMajor() - Version.fromString(b, Version.Mode.RELAXED).getMajor() <= 1)
165166
.sorted(reverseOrder(comparing(s -> Version.fromString(s, Version.Mode.RELAXED))))
166167
.toList();
167168

build-tools-internal/src/test/groovy/org/elasticsearch/gradle/internal/BwcVersionsSpec.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class BwcVersionsSpec extends Specification {
3737

3838
then:
3939
unreleased == [
40-
(v('8.15.2')): new UnreleasedVersionInfo(v('8.15.2'), '8.15', ':distribution:bwc:bugfix2'),
40+
(v('8.15.2')): new UnreleasedVersionInfo(v('8.15.2'), '8.15', ':distribution:bwc:maintenance'),
4141
(v('8.16.1')): new UnreleasedVersionInfo(v('8.16.1'), '8.16', ':distribution:bwc:bugfix'),
4242
(v('8.17.0')): new UnreleasedVersionInfo(v('8.17.0'), '8.x', ':distribution:bwc:minor'),
4343
(v('9.0.0')): new UnreleasedVersionInfo(v('9.0.0'), 'main', ':distribution'),
@@ -67,7 +67,7 @@ class BwcVersionsSpec extends Specification {
6767

6868
then:
6969
unreleased == [
70-
(v('8.15.2')): new UnreleasedVersionInfo(v('8.15.2'), '8.15', ':distribution:bwc:bugfix2'),
70+
(v('8.15.2')): new UnreleasedVersionInfo(v('8.15.2'), '8.15', ':distribution:bwc:maintenance'),
7171
(v('8.16.1')): new UnreleasedVersionInfo(v('8.16.1'), '8.16', ':distribution:bwc:bugfix'),
7272
(v('8.17.0')): new UnreleasedVersionInfo(v('8.17.0'), '8.17', ':distribution:bwc:staged'),
7373
(v('8.18.0')): new UnreleasedVersionInfo(v('8.18.0'), '8.x', ':distribution:bwc:minor'),
@@ -99,7 +99,7 @@ class BwcVersionsSpec extends Specification {
9999

100100
then:
101101
unreleased == [
102-
(v('8.16.2')): new UnreleasedVersionInfo(v('8.16.2'), '8.16', ':distribution:bwc:bugfix2'),
102+
(v('8.16.2')): new UnreleasedVersionInfo(v('8.16.2'), '8.16', ':distribution:bwc:maintenance'),
103103
(v('8.17.1')): new UnreleasedVersionInfo(v('8.17.1'), '8.17', ':distribution:bwc:bugfix'),
104104
(v('8.18.0')): new UnreleasedVersionInfo(v('8.18.0'), '8.18', ':distribution:bwc:staged2'),
105105
(v('8.19.0')): new UnreleasedVersionInfo(v('8.19.0'), '8.x', ':distribution:bwc:minor'),

0 commit comments

Comments
 (0)