2015-11-25 03:13:59 -05:00
|
|
|
import org.elasticsearch.gradle.LoggedExec
|
|
|
|
|
2015-11-24 23:19:04 -05:00
|
|
|
apply plugin: 'elasticsearch.rest-test'
|
|
|
|
|
|
|
|
dependencies {
|
2015-11-25 10:18:08 -05:00
|
|
|
testCompile project(path: ':x-plugins:elasticsearch:shield', configuration: 'runtime')
|
2015-11-24 23:19:04 -05:00
|
|
|
}
|
|
|
|
|
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',
|
|
|
|
'-ext', 'san=dns:localhost,ip:127.0.0.1',
|
|
|
|
'-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
|
|
|
|
|
|
|
// add ES plugins, this loop must be outside of a configuration closure, otherwise it may get executed multiple times
|
|
|
|
for (Project subproj : project.rootProject.subprojects) {
|
|
|
|
if (subproj.path.startsWith(':plugins:')) {
|
|
|
|
// need to get a non-decorated project object, so must re-lookup the project by path
|
|
|
|
integTest.clusterConfig.plugin(subproj.name, project(subproj.path))
|
|
|
|
}
|
|
|
|
}
|
2015-11-24 23:19:04 -05:00
|
|
|
|
|
|
|
integTest {
|
|
|
|
cluster {
|
|
|
|
// TODO: use some variable here for port number
|
|
|
|
systemProperty 'es.marvel.agent.exporter.es.hosts', 'https://marvel_export:changeme@localhost:9400'
|
2015-11-25 03:13:59 -05:00
|
|
|
systemProperty 'es.marvel.agent.exporter.es.ssl.truststore.path', keystore.name
|
2015-11-24 23:19:04 -05:00
|
|
|
systemProperty 'es.marvel.agent.exporter.es.ssl.truststore.password', 'keypass'
|
|
|
|
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 10:18:08 -05:00
|
|
|
plugin 'licence', project(':x-plugins:elasticsearch:license:plugin')
|
|
|
|
plugin 'shield', project(':x-plugins:elasticsearch:shield')
|
|
|
|
plugin 'watcher', project(':x-plugins:elasticsearch:watcher')
|
|
|
|
plugin 'marvel-agent', project(':x-plugins:elasticsearch:marvel')
|
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',
|
|
|
|
'bin/shield/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
|
|
|
|
setupCommand 'setupMarvelUser',
|
|
|
|
'bin/shield/esusers', 'useradd', 'marvel_export', '-p', 'changeme', '-r', 'marvel_agent'
|
|
|
|
waitCondition = { node, ant ->
|
|
|
|
// we just return true, doing an https check is tricky here
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
2015-11-28 21:07:37 -05:00
|
|
|
}
|