2018-07-10 03:26:48 -04:00
|
|
|
import org.elasticsearch.gradle.LoggedExec
|
|
|
|
|
|
|
|
apply plugin: 'elasticsearch.standalone-rest-test'
|
|
|
|
apply plugin: 'elasticsearch.rest-test'
|
|
|
|
|
|
|
|
dependencies {
|
2018-07-24 11:53:04 -04:00
|
|
|
testCompile project(path: xpackModule('core'), configuration: 'shadow')
|
2018-07-10 03:26:48 -04:00
|
|
|
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
|
|
|
testCompile project(path: xpackModule('ml'), configuration: 'runtime')
|
|
|
|
testCompile project(path: xpackModule('ml'), configuration: 'testArtifacts')
|
|
|
|
}
|
|
|
|
|
|
|
|
integTestRunner {
|
|
|
|
/*
|
|
|
|
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
|
|
|
|
* other if we allow them to set the number of available processors as it's set-once in Netty.
|
|
|
|
*/
|
|
|
|
systemProperty 'es.set.netty.runtime.available.processors', 'false'
|
|
|
|
}
|
|
|
|
|
2018-07-24 05:48:14 -04:00
|
|
|
// location for keys and certificates
|
2018-07-10 03:26:48 -04:00
|
|
|
File keystoreDir = new File(project.buildDir, 'keystore')
|
2018-07-24 05:48:14 -04:00
|
|
|
File nodeKey = file("$keystoreDir/testnode.pem")
|
|
|
|
File nodeCert = file("$keystoreDir/testnode.crt")
|
|
|
|
// Add key and certs to test classpath: it expects it there
|
|
|
|
task copyKeyCerts(type: Copy) {
|
|
|
|
from(project(':x-pack:plugin:core').file('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/')) {
|
|
|
|
include 'testnode.crt', 'testnode.pem'
|
2018-07-10 03:26:48 -04:00
|
|
|
}
|
2018-07-24 05:48:14 -04:00
|
|
|
into keystoreDir
|
2018-07-10 03:26:48 -04:00
|
|
|
}
|
2018-07-24 05:48:14 -04:00
|
|
|
// Add keys and cets to test classpath: it expects it there
|
2018-07-10 03:26:48 -04:00
|
|
|
sourceSets.test.resources.srcDir(keystoreDir)
|
2018-07-24 05:48:14 -04:00
|
|
|
processTestResources.dependsOn(copyKeyCerts)
|
2018-07-10 03:26:48 -04:00
|
|
|
|
|
|
|
integTestCluster {
|
2018-07-24 05:48:14 -04:00
|
|
|
dependsOn copyKeyCerts
|
2018-07-10 03:26:48 -04:00
|
|
|
setting 'xpack.security.enabled', 'true'
|
|
|
|
setting 'xpack.ml.enabled', 'true'
|
|
|
|
setting 'logger.org.elasticsearch.xpack.ml.datafeed', 'TRACE'
|
|
|
|
setting 'xpack.monitoring.enabled', 'false'
|
|
|
|
setting 'xpack.security.authc.token.enabled', 'true'
|
|
|
|
setting 'xpack.security.transport.ssl.enabled', 'true'
|
2018-07-24 05:48:14 -04:00
|
|
|
setting 'xpack.security.transport.ssl.key', nodeKey.name
|
|
|
|
setting 'xpack.security.transport.ssl.certificate', nodeCert.name
|
2018-07-10 03:26:48 -04:00
|
|
|
setting 'xpack.security.transport.ssl.verification_mode', 'certificate'
|
|
|
|
setting 'xpack.security.audit.enabled', 'true'
|
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
|
|
|
|
|
|
keystoreSetting 'bootstrap.password', 'x-pack-test-password'
|
2018-07-24 05:48:14 -04:00
|
|
|
keystoreSetting 'xpack.security.transport.ssl.secure_key_passphrase', 'testnode'
|
2018-07-10 03:26:48 -04:00
|
|
|
|
|
|
|
numNodes = 3
|
|
|
|
|
|
|
|
setupCommand 'setupDummyUser',
|
|
|
|
'bin/elasticsearch-users', 'useradd', 'x_pack_rest_user', '-p', 'x-pack-test-password', '-r', 'superuser'
|
|
|
|
|
2018-07-24 05:48:14 -04:00
|
|
|
extraConfigFile nodeKey.name, nodeKey
|
|
|
|
extraConfigFile nodeCert.name, nodeCert
|
2018-07-10 03:26:48 -04:00
|
|
|
|
|
|
|
waitCondition = { node, ant ->
|
|
|
|
File tmpFile = new File(node.cwd, 'wait.success')
|
|
|
|
ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=${numNodes}&wait_for_status=yellow",
|
|
|
|
dest: tmpFile.toString(),
|
|
|
|
username: 'x_pack_rest_user',
|
|
|
|
password: 'x-pack-test-password',
|
|
|
|
ignoreerrors: true,
|
|
|
|
retries: 10)
|
|
|
|
return tmpFile.exists()
|
|
|
|
}
|
|
|
|
}
|