build.gradle 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import org.elasticsearch.gradle.LoggedExec
  2. apply plugin: 'elasticsearch.standalone-rest-test'
  3. apply plugin: 'elasticsearch.rest-test'
  4. dependencies {
  5. // "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here
  6. testCompile project(path: xpackModule('core'), configuration: 'default')
  7. testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
  8. testCompile project(path: xpackModule('ml'), configuration: 'runtime')
  9. testCompile project(path: xpackModule('ml'), configuration: 'testArtifacts')
  10. }
  11. integTestRunner {
  12. /*
  13. * We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
  14. * other if we allow them to set the number of available processors as it's set-once in Netty.
  15. */
  16. systemProperty 'es.set.netty.runtime.available.processors', 'false'
  17. }
  18. // location for keys and certificates
  19. File keystoreDir = new File(project.buildDir, 'keystore')
  20. File nodeKey = file("$keystoreDir/testnode.pem")
  21. File nodeCert = file("$keystoreDir/testnode.crt")
  22. // Add key and certs to test classpath: it expects it there
  23. task copyKeyCerts(type: Copy) {
  24. from(project(':x-pack:plugin:core').file('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/')) {
  25. include 'testnode.crt', 'testnode.pem'
  26. }
  27. into keystoreDir
  28. }
  29. // Add keys and cets to test classpath: it expects it there
  30. sourceSets.test.resources.srcDir(keystoreDir)
  31. processTestResources.dependsOn(copyKeyCerts)
  32. integTestCluster {
  33. dependsOn copyKeyCerts
  34. setting 'xpack.security.enabled', 'true'
  35. setting 'xpack.ml.enabled', 'true'
  36. setting 'logger.org.elasticsearch.xpack.ml.datafeed', 'TRACE'
  37. setting 'xpack.monitoring.enabled', 'false'
  38. setting 'xpack.security.authc.token.enabled', 'true'
  39. setting 'xpack.security.transport.ssl.enabled', 'true'
  40. setting 'xpack.security.transport.ssl.key', nodeKey.name
  41. setting 'xpack.security.transport.ssl.certificate', nodeCert.name
  42. setting 'xpack.security.transport.ssl.verification_mode', 'certificate'
  43. setting 'xpack.security.audit.enabled', 'true'
  44. setting 'xpack.license.self_generated.type', 'trial'
  45. keystoreSetting 'bootstrap.password', 'x-pack-test-password'
  46. keystoreSetting 'xpack.security.transport.ssl.secure_key_passphrase', 'testnode'
  47. numNodes = 3
  48. setupCommand 'setupDummyUser',
  49. 'bin/elasticsearch-users', 'useradd', 'x_pack_rest_user', '-p', 'x-pack-test-password', '-r', 'superuser'
  50. extraConfigFile nodeKey.name, nodeKey
  51. extraConfigFile nodeCert.name, nodeCert
  52. waitCondition = { node, ant ->
  53. File tmpFile = new File(node.cwd, 'wait.success')
  54. ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=${numNodes}&wait_for_status=yellow",
  55. dest: tmpFile.toString(),
  56. username: 'x_pack_rest_user',
  57. password: 'x-pack-test-password',
  58. ignoreerrors: true,
  59. retries: 10)
  60. return tmpFile.exists()
  61. }
  62. }