2015-11-25 03:13:59 -05:00
|
|
|
import org.elasticsearch.gradle.LoggedExec
|
2015-12-04 02:36:35 -05:00
|
|
|
import org.elasticsearch.gradle.MavenFilteringHack
|
2015-11-25 03:13:59 -05:00
|
|
|
|
2015-11-24 23:19:04 -05:00
|
|
|
apply plugin: 'elasticsearch.rest-test'
|
|
|
|
|
|
|
|
dependencies {
|
2015-11-25 18:28:45 -05:00
|
|
|
testCompile project(path: ':x-plugins:elasticsearch:x-pack', configuration: 'runtime')
|
2015-11-24 23:19:04 -05:00
|
|
|
}
|
|
|
|
|
2016-01-18 22:45:36 -05:00
|
|
|
// needed to be consistent with ssl host checking
|
|
|
|
String host = InetAddress.getLoopbackAddress().getHostAddress();
|
|
|
|
|
2015-11-25 03:13:59 -05:00
|
|
|
// location of keystore and files to generate it
|
2015-11-24 23:19:04 -05:00
|
|
|
File keystore = new File(project.buildDir, 'keystore/test-node.jks')
|
|
|
|
|
2015-11-25 03:13:59 -05:00
|
|
|
// generate the keystore
|
|
|
|
task createKey(type: LoggedExec) {
|
|
|
|
doFirst {
|
|
|
|
project.delete(keystore.parentFile)
|
|
|
|
keystore.parentFile.mkdirs()
|
2015-11-24 23:19:04 -05:00
|
|
|
}
|
2015-11-25 03:13:59 -05:00
|
|
|
executable = 'keytool'
|
|
|
|
standardInput = new ByteArrayInputStream('FirstName LastName\nUnit\nOrganization\nCity\nState\nNL\nyes\n\n'.getBytes('UTF-8'))
|
|
|
|
args '-genkey',
|
|
|
|
'-alias', 'test-node',
|
|
|
|
'-keystore', keystore,
|
|
|
|
'-keyalg', 'RSA',
|
|
|
|
'-keysize', '2048',
|
|
|
|
'-validity', '712',
|
2016-01-18 22:45:36 -05:00
|
|
|
'-dname', 'CN=' + host,
|
2016-01-18 19:41:30 -05:00
|
|
|
'-keypass', 'keypass',
|
2015-11-25 03:13:59 -05:00
|
|
|
'-storepass', 'keypass'
|
2015-11-24 23:19:04 -05:00
|
|
|
}
|
|
|
|
|
2015-11-25 03:13:59 -05:00
|
|
|
// add keystore to test classpath: it expects it there
|
|
|
|
sourceSets.test.resources.srcDir(keystore.parentFile)
|
2015-11-30 09:28:16 -05:00
|
|
|
processTestResources.dependsOn(createKey)
|
2015-11-25 03:13:59 -05:00
|
|
|
|
2015-12-04 14:52:31 -05:00
|
|
|
ext.pluginsCount = 1 // we install xpack explicitly
|
2015-12-04 02:36:35 -05:00
|
|
|
project.rootProject.subprojects.findAll { it.path.startsWith(':plugins:') }.each { subproj ->
|
|
|
|
// need to get a non-decorated project object, so must re-lookup the project by path
|
2016-02-12 10:40:27 -05:00
|
|
|
// FIXME - fix shield settings to not rely on iteration order so this doesn't break!
|
|
|
|
if (subproj.name.equals("discovery-ec2") == false) {
|
|
|
|
integTest.cluster.plugin(subproj.name, project(subproj.path))
|
|
|
|
pluginsCount += 1
|
|
|
|
}
|
2015-11-25 03:13:59 -05:00
|
|
|
}
|
2015-11-24 23:19:04 -05:00
|
|
|
|
|
|
|
integTest {
|
|
|
|
cluster {
|
2016-01-18 22:45:36 -05:00
|
|
|
systemProperty 'es.network.host', host
|
2016-02-10 20:18:21 -05:00
|
|
|
systemProperty 'es.xpack.monitoring.agent.exporters.es.type', 'http'
|
|
|
|
systemProperty 'es.xpack.monitoring.agent.exporters.es.enabled', 'false'
|
|
|
|
systemProperty 'es.xpack.monitoring.agent.exporters.es.ssl.truststore.path', keystore.name
|
|
|
|
systemProperty 'es.xpack.monitoring.agent.exporters.es.ssl.truststore.password', 'keypass'
|
2015-11-24 23:19:04 -05:00
|
|
|
systemProperty 'es.shield.transport.ssl', 'true'
|
|
|
|
systemProperty 'es.shield.http.ssl', 'true'
|
2015-11-25 03:13:59 -05:00
|
|
|
systemProperty 'es.shield.ssl.keystore.path', keystore.name
|
2015-11-24 23:19:04 -05:00
|
|
|
systemProperty 'es.shield.ssl.keystore.password', 'keypass'
|
2015-11-25 18:28:45 -05:00
|
|
|
plugin 'x-pack', project(':x-plugins:elasticsearch:x-pack')
|
2015-11-24 23:19:04 -05:00
|
|
|
|
|
|
|
// copy keystore into config/
|
2015-11-25 03:13:59 -05:00
|
|
|
extraConfigFile keystore.name, keystore
|
2015-11-24 23:19:04 -05:00
|
|
|
setupCommand 'setupTestUser',
|
2016-02-05 05:13:30 -05:00
|
|
|
'bin/xpack/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
|
2015-11-24 23:19:04 -05:00
|
|
|
setupCommand 'setupMarvelUser',
|
2016-02-05 05:13:30 -05:00
|
|
|
'bin/xpack/esusers', 'useradd', 'marvel_export', '-p', 'changeme', '-r', 'marvel_agent'
|
2015-11-24 23:19:04 -05:00
|
|
|
waitCondition = { node, ant ->
|
|
|
|
// we just return true, doing an https check is tricky here
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
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) {
|
|
|
|
include '**/*.yaml'
|
|
|
|
inputs.properties(expansions)
|
|
|
|
MavenFilteringHack.filter(it, expansions)
|
|
|
|
}
|
|
|
|
}
|