build.gradle 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. import org.elasticsearch.gradle.test.RestIntegTestTask
  20. import org.elasticsearch.gradle.Version
  21. apply plugin: 'elasticsearch.standalone-test'
  22. // This is a top level task which we will add dependencies to below.
  23. // It is a single task that can be used to backcompat tests against all versions.
  24. task bwcTest {
  25. description = 'Runs backwards compatibility tests.'
  26. group = 'verification'
  27. }
  28. for (Version version : bwcVersions.wireCompatible) {
  29. String baseName = "v${version}"
  30. Task mixedClusterTest = tasks.create(name: "${baseName}#mixedClusterTest", type: RestIntegTestTask) {
  31. mustRunAfter(precommit)
  32. includePackaged = true
  33. }
  34. /* This project runs the core REST tests against a 4 node cluster where two of
  35. the nodes has a different minor. */
  36. Object extension = extensions.findByName("${baseName}#mixedClusterTestCluster")
  37. configure(extension) {
  38. numNodes = 4
  39. numBwcNodes = 2
  40. bwcVersion = version
  41. }
  42. Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
  43. dependsOn = [mixedClusterTest]
  44. }
  45. if (project.bwc_tests_enabled) {
  46. bwcTest.dependsOn(versionBwcTest)
  47. }
  48. tasks.getByName("${baseName}#mixedClusterTestRunner").configure {
  49. /* To support taking index snapshots, we have to set path.repo setting */
  50. systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
  51. }
  52. }
  53. unitTest.enabled = false // no unit tests for rolling upgrades, only the rest integration test
  54. // basic integ tests includes testing bwc against the most recent version
  55. task bwcTestSnapshots {
  56. if (project.bwc_tests_enabled) {
  57. for (final def version : bwcVersions.unreleasedWireCompatible) {
  58. dependsOn "v${version}#bwcTest"
  59. }
  60. }
  61. }
  62. check.dependsOn(bwcTestSnapshots)