mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-06 13:08:29 +00:00
This commit introduces a consistent, and type-safe manner for handling global build parameters through out our build logic. Primarily this replaces the existing usages of extra properties with static accessors. It also introduces and explicit API for initialization and mutation of any such parameters, as well as better error handling for uninitialized or eager access of parameter values. Closes #42042
123 lines
4.6 KiB
Groovy
123 lines
4.6 KiB
Groovy
import org.elasticsearch.gradle.Version
|
|
import org.elasticsearch.gradle.info.BuildParams
|
|
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
|
|
|
|
apply plugin: 'elasticsearch.testclusters'
|
|
apply plugin: 'elasticsearch.standalone-test'
|
|
|
|
dependencies {
|
|
testCompile project(':x-pack:qa')
|
|
}
|
|
|
|
tasks.register("bwcTest") {
|
|
description = 'Runs backwards compatibility tests.'
|
|
group = 'verification'
|
|
}
|
|
|
|
configurations {
|
|
restSpec
|
|
}
|
|
|
|
dependencies {
|
|
restSpec project(':rest-api-spec')
|
|
}
|
|
|
|
processTestResources {
|
|
dependsOn configurations.restSpec
|
|
from ({ zipTree(configurations.restSpec.singleFile) }) {
|
|
include 'rest-api-spec/api/**'
|
|
}
|
|
from (project(xpackProject('plugin').path).sourceSets.test.resources) {
|
|
include 'rest-api-spec/api/**'
|
|
}
|
|
}
|
|
|
|
|
|
for (Version bwcVersion : bwcVersions.wireCompatible) {
|
|
String baseName = "v${bwcVersion}"
|
|
|
|
testClusters {
|
|
"${baseName}" {
|
|
testDistribution = "DEFAULT"
|
|
versions = [bwcVersion.toString(), project.version]
|
|
numberOfNodes = 3
|
|
|
|
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
|
|
setting 'xpack.security.enabled', 'false'
|
|
setting 'xpack.monitoring.enabled', 'false'
|
|
setting 'xpack.ml.enabled', 'false'
|
|
setting 'xpack.watcher.enabled', 'false'
|
|
setting 'xpack.license.self_generated.type', 'basic'
|
|
javaHome = BuildParams.runtimeJavaHome
|
|
}
|
|
}
|
|
|
|
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
|
|
useCluster testClusters."${baseName}"
|
|
mustRunAfter(precommit)
|
|
systemProperty 'tests.rest.suite', 'old_cluster'
|
|
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
|
|
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
|
|
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
|
|
}
|
|
|
|
|
|
tasks.register("${baseName}#oneThirdUpgradedTest", RestTestRunnerTask) {
|
|
dependsOn "${baseName}#oldClusterTest"
|
|
useCluster testClusters."${baseName}"
|
|
doFirst {
|
|
testClusters."${baseName}".nextNodeToNextVersion()
|
|
}
|
|
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
|
|
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
|
|
systemProperty 'tests.rest.suite', 'mixed_cluster'
|
|
systemProperty 'tests.first_round', 'true'
|
|
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
|
|
}
|
|
|
|
tasks.register("${baseName}#twoThirdsUpgradedTest", RestTestRunnerTask) {
|
|
dependsOn "${baseName}#oneThirdUpgradedTest"
|
|
useCluster testClusters."${baseName}"
|
|
doFirst {
|
|
testClusters."${baseName}".nextNodeToNextVersion()
|
|
}
|
|
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
|
|
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
|
|
systemProperty 'tests.rest.suite', 'mixed_cluster'
|
|
systemProperty 'tests.first_round', 'false'
|
|
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
|
|
}
|
|
|
|
tasks.register("${baseName}#upgradedClusterTest", RestTestRunnerTask) {
|
|
dependsOn "${baseName}#twoThirdsUpgradedTest"
|
|
useCluster testClusters."${baseName}"
|
|
doFirst {
|
|
testClusters."${baseName}".nextNodeToNextVersion()
|
|
}
|
|
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",") }")
|
|
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName() }")
|
|
systemProperty 'tests.rest.suite', 'upgraded_cluster'
|
|
systemProperty 'tests.upgrade_from_version', bwcVersion.toString().replace('-SNAPSHOT', '')
|
|
}
|
|
|
|
tasks.register("${baseName}#bwcTest") {
|
|
dependsOn "${baseName}#upgradedClusterTest"
|
|
}
|
|
|
|
if (project.bwc_tests_enabled) {
|
|
bwcTest.dependsOn("${baseName}#bwcTest")
|
|
}
|
|
}
|
|
|
|
task bwcTestSnapshots {
|
|
if (project.bwc_tests_enabled) {
|
|
for (final def version : bwcVersions.unreleasedWireCompatible) {
|
|
dependsOn "v${version}#bwcTest"
|
|
}
|
|
}
|
|
}
|
|
check.dependsOn(bwcTestSnapshots)
|
|
|
|
compileTestJava.options.compilerArgs << "-Xlint:-cast,-rawtypes,-unchecked"
|
|
|
|
test.enabled = false |