elasticsearch/rest-api-spec/build.gradle
Mark Vieira 47c6fd34da
[7.17] Add JUnit rule based integration test cluster orchestration framework… (#92517)
This commit adds a new test framework for configuring and orchestrating
test clusters for both Java and YAML REST testing. This will eventually
replace the existing "test-clusters" Gradle plugin and the build-time
cluster orchestration.
2022-12-22 17:48:07 -08:00

52 lines
1.5 KiB
Groovy

apply plugin: 'elasticsearch.build'
apply plugin: 'elasticsearch.publish'
apply plugin: 'elasticsearch.rest-resources'
apply plugin: 'elasticsearch.validate-rest-spec'
apply plugin: 'elasticsearch.internal-yaml-rest-test'
restResources {
restTests {
includeCore '*'
}
}
// REST API specifications are published under the Apache 2.0 License
ext.projectLicenses.set(['The Apache Software License, Version 2.0': 'http://www.apache.org/licenses/LICENSE-2.0'])
licenseFile.set(rootProject.file('licenses/APACHE-LICENSE-2.0.txt'))
configurations {
// configuration to make use by external yaml rest test plugin in our examples
// easy and efficient
basicRestSpecs {
attributes {
attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.DIRECTORY_TYPE)
}
}
}
artifacts {
basicRestSpecs(new File(projectDir, "src/main/resources"))
restSpecs(new File(projectDir, "src/main/resources/rest-api-spec/api"))
restTests(new File(projectDir, "src/yamlRestTest/resources/rest-api-spec/test"))
}
dependencies {
clusterModules project(":modules:mapper-extras")
}
tasks.named("test").configure {enabled = false }
tasks.named("jarHell").configure {enabled = false }
tasks.register('enforceYamlTestConvention').configure {
doLast {
if (fileTree('src/main/resources/rest-api-spec/test').files) {
throw new GradleException("There are YAML tests in src/main source set. These should be moved to src/yamlRestTest.")
}
}
}
tasks.named("precommit").configure {
dependsOn 'enforceYamlTestConvention'
}