| 
7 | 7 |  * License v3.0 only", or the "Server Side Public License, v 1".  | 
8 | 8 |  */  | 
9 | 9 | 
 
  | 
10 |  | -import org.elasticsearch.gradle.VersionProperties  | 
 | 10 | +import org.elasticsearch.gradle.Version  | 
11 | 11 | import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask  | 
12 | 12 | 
 
  | 
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 | +    }  | 
23 | 27 |   }  | 
24 | 28 | }  | 
25 | 29 | 
 
  | 
 | 
0 commit comments