86 lines
2.9 KiB
Groovy
86 lines
2.9 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.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 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)
|
|
}
|
|
}
|