build.gradle 3.1 KB

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