2015-12-04 02:36:35 -05:00
|
|
|
import org.elasticsearch.gradle.MavenFilteringHack
|
2016-08-30 12:57:42 -04:00
|
|
|
import org.elasticsearch.gradle.test.NodeInfo
|
2019-04-04 06:44:03 -04:00
|
|
|
import org.elasticsearch.gradle.http.WaitForHttpResource
|
2015-11-25 03:13:59 -05:00
|
|
|
|
2017-01-04 14:27:53 -05:00
|
|
|
apply plugin: 'elasticsearch.standalone-rest-test'
|
2015-11-24 23:19:04 -05:00
|
|
|
apply plugin: 'elasticsearch.rest-test'
|
|
|
|
|
|
|
|
dependencies {
|
2019-06-04 16:50:23 -04:00
|
|
|
testCompile project(':x-pack:plugin:core')
|
2015-11-24 23:19:04 -05:00
|
|
|
}
|
|
|
|
|
2018-04-26 18:36:14 -04:00
|
|
|
String outputDir = "${buildDir}/generated-resources/${project.name}"
|
2016-04-12 09:19:07 -04:00
|
|
|
task copyXPackPluginProps(type: Copy) {
|
2018-01-27 00:48:30 -05:00
|
|
|
from project(xpackModule('core')).file('src/main/plugin-metadata')
|
|
|
|
from project(xpackModule('core')).tasks.pluginProperties
|
2016-04-12 09:19:07 -04:00
|
|
|
into outputDir
|
|
|
|
}
|
|
|
|
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackPluginProps)
|
|
|
|
|
2016-02-08 08:33:27 -05:00
|
|
|
// location of generated keystores and certificates
|
|
|
|
File keystoreDir = new File(project.buildDir, 'keystore')
|
2018-07-24 05:48:14 -04:00
|
|
|
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")
|
2016-02-08 08:33:27 -05:00
|
|
|
|
2018-07-24 05:48:14 -04:00
|
|
|
// Add keystores to test classpath: it expects it there
|
|
|
|
task copyKeyCerts(type: Copy) {
|
|
|
|
from('./') {
|
|
|
|
include '*.crt', '*.pem', '*.jks'
|
2016-02-08 08:33:27 -05:00
|
|
|
}
|
2018-07-24 05:48:14 -04:00
|
|
|
into keystoreDir
|
2016-02-08 08:33:27 -05:00
|
|
|
}
|
|
|
|
// Add keystores to test classpath: it expects it there
|
|
|
|
sourceSets.test.resources.srcDir(keystoreDir)
|
2018-07-24 05:48:14 -04:00
|
|
|
processTestResources.dependsOn(copyKeyCerts)
|
2015-11-25 03:13:59 -05:00
|
|
|
|
2018-07-24 05:48:14 -04:00
|
|
|
integTestCluster.dependsOn(copyKeyCerts)
|
2017-09-14 14:18:54 -04:00
|
|
|
|
2018-01-20 00:30:17 -05:00
|
|
|
ext.pluginsCount = 0
|
2018-04-27 10:49:06 -04:00
|
|
|
project(':plugins').getChildProjects().each { pluginName, pluginProject ->
|
2015-12-04 02:36:35 -05:00
|
|
|
// need to get a non-decorated project object, so must re-lookup the project by path
|
2018-04-27 10:49:06 -04:00
|
|
|
integTestCluster.plugin(pluginProject.path)
|
2016-02-21 13:10:21 -05:00
|
|
|
pluginsCount += 1
|
2015-11-25 03:13:59 -05:00
|
|
|
}
|
2015-11-24 23:19:04 -05:00
|
|
|
|
2017-02-22 03:56:52 -05:00
|
|
|
integTestCluster {
|
2018-02-23 10:33:34 -05:00
|
|
|
setting 'xpack.monitoring.collection.interval', '1s'
|
2017-02-22 03:56:52 -05:00
|
|
|
setting 'xpack.monitoring.exporters._http.type', 'http'
|
|
|
|
setting 'xpack.monitoring.exporters._http.enabled', 'false'
|
|
|
|
setting 'xpack.monitoring.exporters._http.auth.username', 'monitoring_agent'
|
2017-06-29 16:27:57 -04:00
|
|
|
setting 'xpack.monitoring.exporters._http.auth.password', 'x-pack-test-password'
|
2017-12-05 06:07:04 -05:00
|
|
|
setting 'xpack.monitoring.exporters._http.ssl.verification_mode', 'full'
|
2019-01-14 16:06:22 -05:00
|
|
|
setting 'xpack.monitoring.exporters._http.ssl.certificate_authorities', 'testnode.crt'
|
2017-02-22 03:56:52 -05:00
|
|
|
|
2018-05-03 12:33:08 -04:00
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
2018-03-21 23:09:44 -04:00
|
|
|
setting 'xpack.security.enabled', 'true'
|
2017-02-22 03:56:52 -05:00
|
|
|
setting 'xpack.security.http.ssl.enabled', 'true'
|
2018-07-24 05:48:14 -04:00
|
|
|
setting 'xpack.security.http.ssl.key', 'testnode.pem'
|
|
|
|
setting 'xpack.security.http.ssl.certificate', 'testnode.crt'
|
2019-01-14 16:06:22 -05:00
|
|
|
setting 'xpack.security.http.ssl.certificate_authorities', 'testnode.crt'
|
2018-07-24 05:48:14 -04:00
|
|
|
keystoreSetting 'xpack.security.http.ssl.secure_key_passphrase', 'testnode'
|
2017-02-22 03:56:52 -05:00
|
|
|
|
2018-08-02 13:05:11 -04:00
|
|
|
setting 'xpack.ilm.enabled', 'false'
|
2017-03-02 12:01:05 -05:00
|
|
|
setting 'xpack.ml.enabled', 'false'
|
2018-07-24 05:48:14 -04:00
|
|
|
// copy keystores, keys and certificates into config/
|
2017-02-22 03:56:52 -05:00
|
|
|
extraConfigFile nodeKeystore.name, nodeKeystore
|
2018-07-24 05:48:14 -04:00
|
|
|
extraConfigFile nodeKey.name, nodeKey
|
|
|
|
extraConfigFile nodeCert.name, nodeCert
|
2017-02-22 03:56:52 -05:00
|
|
|
extraConfigFile clientKeyStore.name, clientKeyStore
|
2018-07-24 05:48:14 -04:00
|
|
|
extraConfigFile clientKey.name, clientKey
|
|
|
|
extraConfigFile clientCert.name, clientCert
|
2017-02-22 03:56:52 -05:00
|
|
|
|
|
|
|
setupCommand 'setupTestUser',
|
2018-04-11 11:36:12 -04:00
|
|
|
'bin/elasticsearch-users', 'useradd', 'test_user', '-p', 'x-pack-test-password', '-r', 'superuser'
|
2017-02-22 03:56:52 -05:00
|
|
|
setupCommand 'setupMonitoringUser',
|
2018-04-11 11:36:12 -04:00
|
|
|
'bin/elasticsearch-users', 'useradd', 'monitoring_agent', '-p', 'x-pack-test-password', '-r', 'remote_monitoring_agent'
|
2017-02-22 03:56:52 -05:00
|
|
|
|
|
|
|
waitCondition = { NodeInfo node, AntBuilder ant ->
|
2019-04-04 06:44:03 -04:00
|
|
|
WaitForHttpResource http = new WaitForHttpResource("https", node.httpUri(), numNodes)
|
|
|
|
http.setTrustStoreFile(clientKeyStore)
|
|
|
|
http.setTrustStorePassword("testclient")
|
|
|
|
http.setUsername("test_user")
|
|
|
|
http.setPassword("x-pack-test-password")
|
|
|
|
return http.wait(5000)
|
2015-11-24 23:19:04 -05:00
|
|
|
}
|
2015-11-28 21:07:37 -05:00
|
|
|
}
|
2015-12-04 02:36:35 -05:00
|
|
|
|
|
|
|
ext.expansions = [
|
|
|
|
'expected.plugins.count': pluginsCount
|
|
|
|
]
|
|
|
|
|
|
|
|
processTestResources {
|
|
|
|
from(sourceSets.test.resources.srcDirs) {
|
2017-05-17 21:07:42 -04:00
|
|
|
include '**/*.yml'
|
2015-12-04 02:36:35 -05:00
|
|
|
inputs.properties(expansions)
|
|
|
|
MavenFilteringHack.filter(it, expansions)
|
|
|
|
}
|
2018-08-21 20:03:28 -04:00
|
|
|
}
|