Skip to content

Commit 3c2dfac

Browse files
committed
Filter out version 8.19 due to incompatibility with 9.0 branch
Updated tests to ensure that version 8.19 is excluded from unreleased versions in the BwC. Added a new test case to verify this behavior specifically for the 9.0 branch.
1 parent 176983b commit 3c2dfac

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class BwcVersionsSpec extends Specification {
111111
def bwc = new BwcVersions(v('9.1.0'), versions, [
112112
branch('main', '9.1.0'),
113113
branch('9.0', '9.0.0'),
114-
branch('8.x', '8.19.0'),
114+
branch('8.x', '8.19.0'), // 8.19 is incompatible with 9.0 so it is not listed in unreleased for BwC
115115
branch('8.18', '8.18.0'),
116116
branch('8.17', '8.17.1'),
117117
branch('8.16', '8.16.2'),
@@ -124,7 +124,6 @@ class BwcVersionsSpec extends Specification {
124124
(v('8.16.2')): new UnreleasedVersionInfo(v('8.16.2'), '8.16', ':distribution:bwc:major4'),
125125
(v('8.17.1')): new UnreleasedVersionInfo(v('8.17.1'), '8.17', ':distribution:bwc:major3'),
126126
(v('8.18.0')): new UnreleasedVersionInfo(v('8.18.0'), '8.18', ':distribution:bwc:major2'),
127-
(v('8.19.0')): new UnreleasedVersionInfo(v('8.19.0'), '8.x', ':distribution:bwc:major1'),
128127
(v('9.0.0')): new UnreleasedVersionInfo(v('9.0.0'), '9.0', ':distribution:bwc:minor1'),
129128
(v('9.1.0')): new UnreleasedVersionInfo(v('9.1.0'), 'main', ':distribution'),
130129
]

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

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ class GlobalBuildInfoPluginSpec extends Specification {
8282
[
8383
new DevelopmentBranch("main", Version.fromString("9.1.0")),
8484
new DevelopmentBranch("9.0", Version.fromString("9.0.3")),
85-
new DevelopmentBranch("8.19", Version.fromString("8.19.1")),
8685
new DevelopmentBranch("8.18", Version.fromString("8.18.2")),
8786
]
8887
)
@@ -94,7 +93,33 @@ class GlobalBuildInfoPluginSpec extends Specification {
9493

9594
then:
9695
bwcVersions != null
97-
bwcVersions.unreleased.toSet() == ["9.1.0", "9.0.3", "8.19.1", "8.18.2"].collect { Version.fromString(it) }.toSet()
96+
bwcVersions.unreleased.toSet() == ["9.1.0", "9.0.3", "8.18.2"].collect { Version.fromString(it) }.toSet()
97+
}
98+
99+
def "should filter 8.19 version as it is incompatible with 9.0 branch - ONLY ON 9.0 BRANCH"() {
100+
given:
101+
ProviderFactory providerFactorySpy = Spy(project.getProviders())
102+
Path branchesJsonPath = projectRoot.toPath().resolve("myBranches.json")
103+
Provider<String> gradleBranchesLocationProvider = project.providers.provider { return branchesJsonPath.toString() }
104+
providerFactorySpy.gradleProperty("org.elasticsearch.build.branches-file-location") >> gradleBranchesLocationProvider
105+
project.getProviders() >> providerFactorySpy
106+
branchesJsonPath.text = branchesJson(
107+
[
108+
new DevelopmentBranch("main", Version.fromString("9.1.0")),
109+
new DevelopmentBranch("9.0", Version.fromString("9.0.3")),
110+
new DevelopmentBranch("8.19", Version.fromString("8.19.3")),
111+
new DevelopmentBranch("8.18", Version.fromString("8.18.2")),
112+
]
113+
)
114+
115+
when:
116+
project.objects.newInstance(GlobalBuildInfoPlugin).apply(project)
117+
BuildParameterExtension ext = project.extensions.getByType(BuildParameterExtension)
118+
BwcVersions bwcVersions = ext.bwcVersions
119+
120+
then:
121+
bwcVersions != null
122+
bwcVersions.unreleased.toSet() == ["9.1.0", "9.0.3", "8.18.2"].collect { Version.fromString(it) }.toSet()
98123
}
99124

100125
String branchesJson(List<DevelopmentBranch> branches) {

0 commit comments

Comments
 (0)