build.gradle 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import org.elasticsearch.gradle.http.WaitForHttpResource
  2. apply plugin: 'elasticsearch.standalone-rest-test'
  3. apply plugin: 'elasticsearch.rest-test'
  4. dependencies {
  5. testCompile project(path: xpackModule('core'), configuration: 'default')
  6. testCompile project(path: xpackModule('security'), configuration: 'testArtifacts')
  7. testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
  8. if (isEclipse) {
  9. testCompile project(path: xpackModule('core-tests'), configuration: 'testArtifacts')
  10. }
  11. testCompile project(path: ':modules:reindex')
  12. }
  13. forbiddenPatterns {
  14. exclude '**/*.key'
  15. exclude '**/*.pem'
  16. exclude '**/*.p12'
  17. exclude '**/*.jks'
  18. }
  19. File caFile = project.file('src/test/resources/ssl/ca.p12')
  20. integTestCluster {
  21. // Whitelist reindexing from the local node so we can test it.
  22. extraConfigFile 'http.key', project.projectDir.toPath().resolve('src/test/resources/ssl/http.key')
  23. extraConfigFile 'http.crt', project.projectDir.toPath().resolve('src/test/resources/ssl/http.crt')
  24. extraConfigFile 'ca.p12', caFile
  25. setting 'reindex.remote.whitelist', '127.0.0.1:*'
  26. setting 'xpack.ilm.enabled', 'false'
  27. setting 'xpack.security.enabled', 'true'
  28. setting 'xpack.ml.enabled', 'false'
  29. setting 'xpack.license.self_generated.type', 'trial'
  30. setting 'xpack.security.http.ssl.enabled', 'true'
  31. setting 'xpack.security.http.ssl.certificate', 'http.crt'
  32. setting 'xpack.security.http.ssl.key', 'http.key'
  33. setting 'xpack.security.http.ssl.key_passphrase', 'http-password'
  34. setting 'reindex.ssl.truststore.path', 'ca.p12'
  35. setting 'reindex.ssl.truststore.password', 'password'
  36. // Workaround for JDK-8212885
  37. rootProject.globalInfo.ready {
  38. if (project.ext.runtimeJavaVersion.isJava12Compatible() == false) {
  39. setting 'reindex.ssl.supported_protocols', 'TLSv1.2'
  40. }
  41. }
  42. extraConfigFile 'roles.yml', 'roles.yml'
  43. [
  44. test_admin: 'superuser',
  45. powerful_user: 'superuser',
  46. minimal_user: 'minimal',
  47. minimal_with_task_user: 'minimal_with_task',
  48. readonly_user: 'readonly',
  49. dest_only_user: 'dest_only',
  50. can_not_see_hidden_docs_user: 'can_not_see_hidden_docs',
  51. can_not_see_hidden_fields_user: 'can_not_see_hidden_fields',
  52. ].each { String user, String role ->
  53. setupCommand 'setupUser#' + user,
  54. 'bin/elasticsearch-users', 'useradd', user, '-p', 'x-pack-test-password', '-r', role
  55. }
  56. waitCondition = { node, ant ->
  57. WaitForHttpResource http = new WaitForHttpResource("https", node.httpUri(), numNodes)
  58. http.setTrustStoreFile(caFile)
  59. http.setTrustStorePassword("password")
  60. http.setUsername("test_admin")
  61. http.setPassword("x-pack-test-password")
  62. return http.wait(5000)
  63. }
  64. }