mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-07 05:28:34 +00:00
dd73a14d11
This commit includes a number of changes to reduce overall build configuration time. These optimizations include: - Removing the usage of the 'nebula.info-scm' plugin. This plugin leverages jgit to load read various pieces of VCS information. This is mostly overkill and we have our own minimal implementation for determining the current commit id. - Removing unnecessary build dependencies such as perforce and jgit now that we don't need them. This reduces our classpath considerably. - Expanding the usage lazy task creation, particularly in our distribution projects. The archives and packages projects create lots of tasks with very complex configuration. Avoiding the creation of these tasks at configuration time gives us a nice boost.
106 lines
4.1 KiB
Groovy
106 lines
4.1 KiB
Groovy
import org.elasticsearch.gradle.Version
|
|
import org.elasticsearch.gradle.testclusters.RestTestRunnerTask
|
|
|
|
apply plugin: 'elasticsearch.testclusters'
|
|
apply plugin: 'elasticsearch.standalone-test'
|
|
apply from : "$rootDir/gradle/bwc-test.gradle"
|
|
|
|
dependencies {
|
|
// TODO: Remove core dependency and change tests to not use builders that are part of xpack-core.
|
|
// Currently needed for ml tests are using the building for datafeed and job config)
|
|
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
|
|
|
testCompile project(path: ':qa:full-cluster-restart', configuration: 'testArtifacts')
|
|
testCompile project(':x-pack:qa')
|
|
}
|
|
|
|
licenseHeaders {
|
|
approvedLicenses << 'Apache'
|
|
}
|
|
|
|
forbiddenPatterns {
|
|
exclude '**/system_key'
|
|
}
|
|
|
|
String outputDir = "${buildDir}/generated-resources/${project.name}"
|
|
|
|
tasks.register("copyTestNodeKeyMaterial", Copy) {
|
|
from project(':x-pack:plugin:core')
|
|
.files(
|
|
'src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.pem',
|
|
'src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.crt'
|
|
)
|
|
into outputDir
|
|
}
|
|
|
|
for (Version bwcVersion : bwcVersions.indexCompatible) {
|
|
String baseName = "v${bwcVersion}"
|
|
|
|
testClusters {
|
|
"${baseName}" {
|
|
testDistribution = "DEFAULT"
|
|
versions = [bwcVersion.toString(), project.version]
|
|
numberOfNodes = 2
|
|
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
|
user username: "test_user", password: "x-pack-test-password"
|
|
|
|
setting 'path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
|
// some tests rely on the translog not being flushed
|
|
setting 'indices.memory.shard_inactive_time', '60m'
|
|
setting 'xpack.security.enabled', 'true'
|
|
setting 'xpack.security.transport.ssl.enabled', 'true'
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
|
|
extraConfigFile 'testnode.pem', file("${outputDir}/testnode.pem")
|
|
extraConfigFile 'testnode.crt', file("${outputDir}/testnode.crt")
|
|
|
|
keystore 'xpack.watcher.encryption_key', file("${project.projectDir}/src/test/resources/system_key")
|
|
setting 'xpack.watcher.encrypt_sensitive_data', 'true'
|
|
|
|
setting 'xpack.security.transport.ssl.key', 'testnode.pem'
|
|
setting 'xpack.security.transport.ssl.certificate', 'testnode.crt'
|
|
keystore 'xpack.security.transport.ssl.secure_key_passphrase', 'testnode'
|
|
setting 'logger.org.elasticsearch.xpack.watcher', 'DEBUG'
|
|
}
|
|
}
|
|
|
|
tasks.register("${baseName}#oldClusterTest", RestTestRunnerTask) {
|
|
mustRunAfter(precommit)
|
|
useCluster testClusters."${baseName}"
|
|
dependsOn copyTestNodeKeyMaterial
|
|
doFirst {
|
|
project.delete("${buildDir}/cluster/shared/repo/${baseName}")
|
|
}
|
|
systemProperty 'tests.is_old_cluster', 'true'
|
|
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
|
exclude 'org/elasticsearch/upgrades/FullClusterRestartSettingsUpgradeIT.class'
|
|
exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
|
|
}
|
|
|
|
|
|
tasks.register("${baseName}#upgradedClusterTest", RestTestRunnerTask) {
|
|
mustRunAfter(precommit)
|
|
useCluster testClusters."${baseName}"
|
|
dependsOn "${baseName}#oldClusterTest"
|
|
doFirst {
|
|
testClusters."${baseName}".goToNextVersion()
|
|
}
|
|
systemProperty 'tests.is_old_cluster', 'false'
|
|
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
|
|
exclude 'org/elasticsearch/upgrades/FullClusterRestartSettingsUpgradeIT.class'
|
|
exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
|
|
}
|
|
|
|
String oldVersion = bwcVersion.toString().minus("-SNAPSHOT")
|
|
tasks.matching { it.name.startsWith(baseName) && it.name.endsWith("ClusterTest") }.configureEach {
|
|
it.systemProperty 'tests.old_cluster_version', oldVersion
|
|
it.systemProperty 'tests.path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
|
|
it.nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
|
|
it.nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
|
|
}
|
|
|
|
tasks.register(bwcTaskName(bwcVersion)) {
|
|
dependsOn "${baseName}#upgradedClusterTest"
|
|
}
|
|
}
|