mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-25 01:19:02 +00:00
* Convert RunTask to use testclusers, remove ClusterFormationTasks This PR adds a new RunTask and a way for it to start a testclusters cluster out of band and block on it to replace the old RunTask that used ClusterFormationTasks. With this we can now remove ClusterFormationTasks.
87 lines
3.0 KiB
Groovy
87 lines
3.0 KiB
Groovy
import org.elasticsearch.gradle.MavenFilteringHack
|
|
|
|
import org.elasticsearch.gradle.http.WaitForHttpResource
|
|
|
|
apply plugin: 'elasticsearch.testclusters'
|
|
apply plugin: 'elasticsearch.standalone-rest-test'
|
|
apply plugin: 'elasticsearch.rest-test'
|
|
|
|
dependencies {
|
|
testCompile project(':x-pack:plugin:core')
|
|
}
|
|
|
|
String outputDir = "${buildDir}/generated-resources/${project.name}"
|
|
task copyXPackPluginProps(type: Copy) {
|
|
from project(xpackModule('core')).file('src/main/plugin-metadata')
|
|
from project(xpackModule('core')).tasks.pluginProperties
|
|
into outputDir
|
|
}
|
|
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackPluginProps)
|
|
|
|
// location of generated keystores and certificates
|
|
File keystoreDir = new File(project.buildDir, 'keystore')
|
|
File nodeKeystore = file("$keystoreDir/testnode.jks")
|
|
File nodeKey = file("$keystoreDir/testnode.pem")
|
|
File nodeCert = file("$keystoreDir/testnode.crt")
|
|
File clientKeyStore = file("$keystoreDir/testclient.jks")
|
|
File clientKey = file("$keystoreDir/testclient.pem")
|
|
File clientCert = file("$keystoreDir/testclient.crt")
|
|
|
|
// Add keystores to test classpath: it expects it there
|
|
task copyKeyCerts(type: Copy) {
|
|
from('./') {
|
|
include '*.crt', '*.pem', '*.jks'
|
|
}
|
|
into keystoreDir
|
|
}
|
|
// Add keystores to test classpath: it expects it there
|
|
sourceSets.test.resources.srcDir(keystoreDir)
|
|
processTestResources.dependsOn(copyKeyCerts)
|
|
|
|
integTest.runner.dependsOn(copyKeyCerts)
|
|
|
|
def pluginsCount = 0
|
|
testClusters.integTest {
|
|
testDistribution = 'DEFAULT'
|
|
setting 'xpack.monitoring.collection.interval', '1s'
|
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
setting 'xpack.security.enabled', 'true'
|
|
setting 'xpack.security.http.ssl.enabled', 'true'
|
|
setting 'xpack.security.http.ssl.key', 'testnode.pem'
|
|
setting 'xpack.security.http.ssl.certificate', 'testnode.crt'
|
|
setting 'xpack.security.http.ssl.certificate_authorities', 'testnode.crt'
|
|
keystore 'xpack.security.http.ssl.secure_key_passphrase', 'testnode'
|
|
|
|
setting 'xpack.ilm.enabled', 'false'
|
|
setting 'xpack.ml.enabled', 'false'
|
|
// copy keystores, keys and certificates into config/
|
|
extraConfigFile nodeKeystore.name, nodeKeystore
|
|
extraConfigFile nodeKey.name, nodeKey
|
|
extraConfigFile nodeCert.name, nodeCert
|
|
extraConfigFile clientKeyStore.name, clientKeyStore
|
|
extraConfigFile clientKey.name, clientKey
|
|
extraConfigFile clientCert.name, clientCert
|
|
|
|
user username: "test_user", password: "x-pack-test-password"
|
|
user username: "monitoring_agent", password: "x-pack-test-password", role: "remote_monitoring_agent"
|
|
|
|
project(':plugins').getChildProjects().each { pluginName, pluginProject ->
|
|
plugin file(pluginProject.tasks.bundlePlugin.archiveFile)
|
|
tasks.integTest.dependsOn pluginProject.tasks.bundlePlugin
|
|
pluginsCount += 1
|
|
}
|
|
}
|
|
|
|
ext.expansions = [
|
|
'expected.plugins.count': pluginsCount
|
|
]
|
|
|
|
processTestResources {
|
|
from(sourceSets.test.resources.srcDirs) {
|
|
include '**/*.yml'
|
|
inputs.properties(expansions)
|
|
MavenFilteringHack.filter(it, expansions)
|
|
}
|
|
}
|