build.gradle 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Licensed to Elasticsearch under one or more contributor
  3. * license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright
  5. * ownership. Elasticsearch licenses this file to you under
  6. * the Apache License, Version 2.0 (the "License"); you may
  7. * not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. apply plugin: 'elasticsearch.docs-test'
  20. integTest {
  21. cluster {
  22. setting 'script.inline', 'true'
  23. }
  24. }
  25. buildRestTests.docs = fileTree(projectDir) {
  26. // No snippets in here!
  27. exclude 'build.gradle'
  28. // That is where the snippets go, not where they come from!
  29. exclude 'build'
  30. // Remove plugins because they aren't installed during this test. Yet?
  31. exclude 'plugins'
  32. // This file simply doesn't pass yet. We should figure out how to fix it.
  33. exclude 'reference/modules/snapshots.asciidoc'
  34. }
  35. Closure setupTwitter = { String name, int count ->
  36. buildRestTests.setups[name] = '''
  37. - do:
  38. bulk:
  39. index: twitter
  40. type: tweet
  41. refresh: true
  42. body: |'''
  43. for (int i = 0; i < count; i++) {
  44. String user, text
  45. if (i == 0) {
  46. user = 'kimchy'
  47. text = 'trying out Elasticsearch'
  48. } else {
  49. user = 'test'
  50. text = "some message with the number $i"
  51. }
  52. buildRestTests.setups[name] += """
  53. {"index":{"_id": "$i"}}
  54. {"user": "$user", "message": "$text", "date": "2009-11-15T14:12:12", "likes": $i}"""
  55. }
  56. }
  57. setupTwitter('twitter', 5)
  58. setupTwitter('big_twitter', 120)