Skip to content

Commit aa17c79

Browse files
committed
Fix FwC test task registration
With this change it takes into account that not all versions have previous minor unreleased version (because we are on the oldest active development branch), or that current version has minor == 0 (e.g. 9.0) so previous minor have to be calculated differently.
1 parent 4ffe49c commit aa17c79

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

build-tools-internal/src/main/groovy/elasticsearch.fwc-test.gradle

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,23 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import org.elasticsearch.gradle.VersionProperties
10+
import org.elasticsearch.gradle.Version
1111
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
1212

13-
def fwcVersions = buildParams.bwcVersions.released.findAll { it.major == VersionProperties.elasticsearchVersion.major && it.minor == VersionProperties.elasticsearchVersion.minor }
14-
def previousMinorSnapshot = buildParams.bwcVersions.unreleased.find { it.major == VersionProperties.elasticsearchVersion.major && it.minor == VersionProperties.elasticsearchVersion.minor - 1 }
15-
16-
fwcVersions.each { fwcVersion ->
17-
tasks.register("v${fwcVersion}#fwcTest", StandaloneRestIntegTestTask) {
18-
usesBwcDistribution(previousMinorSnapshot)
19-
usesBwcDistribution(fwcVersion)
20-
systemProperty("tests.old_cluster_version", previousMinorSnapshot)
21-
systemProperty("tests.new_cluster_version", fwcVersion)
22-
nonInputProperties.systemProperty 'tests.fwc', 'true'
13+
Version elasticsearchVersion = Version.fromString(versions.get("elasticsearch"))
14+
def fwcVersions = buildParams.bwcVersions.released.findAll { it.major == elasticsearchVersion.major && it.minor == elasticsearchVersion.minor }
15+
def targetMajor = elasticsearchVersion.minor > 0 ? elasticsearchVersion.major : elasticsearchVersion.major - 1
16+
def targetMinor = elasticsearchVersion.minor > 0 ? elasticsearchVersion.minor - 1 : buildParams.bwcVersions.unreleased.findAll { it.major == targetMajor }*.minor.max()
17+
def previousMinorSnapshot = buildParams.bwcVersions.unreleased.find { it.major == targetMajor && it.minor == targetMinor }
18+
if (previousMinorSnapshot != null) {
19+
fwcVersions.each { fwcVersion ->
20+
tasks.register("v${fwcVersion}#fwcTest", StandaloneRestIntegTestTask) {
21+
usesBwcDistribution(previousMinorSnapshot)
22+
usesBwcDistribution(fwcVersion)
23+
systemProperty("tests.old_cluster_version", previousMinorSnapshot)
24+
systemProperty("tests.new_cluster_version", fwcVersion)
25+
nonInputProperties.systemProperty 'tests.fwc', 'true'
26+
}
2327
}
2428
}
2529

0 commit comments

Comments
 (0)