[7.x] Convert most OSS plugins from integTest to [yaml | java]RestTest or internalClusterTest (#59444) (#60343)
For all OSS plugins (except repository-* and discovery-*) integTest task is now a no-op and all of the tests are now executed via a test, yamlRestTest, javaRestTest, or internalClusterTest. This commit does NOT convert the discovery-* and repository-* since they are bit more complex then the rest of tests and this PR is large enough. Those plugins will be addressed in a future PR(s). This commit also fixes a minor issue that did not copy the rest api for projects that only had YAML TEST tests. related: #56841
This commit is contained in:
parent
39fa1c4df0
commit
6ce30bea08
|
@ -198,7 +198,7 @@ public class CopyRestApiTask extends DefaultTask {
|
|||
Set<File> resourceDir = testSources.getResources()
|
||||
.getSrcDirs()
|
||||
.stream()
|
||||
.filter(f -> f.isDirectory() && f.getParentFile().getName().equals("test") && f.getName().equals("resources"))
|
||||
.filter(f -> f.isDirectory() && f.getParentFile().getName().equals(getSourceSetName()) && f.getName().equals("resources"))
|
||||
.collect(Collectors.toSet());
|
||||
assert resourceDir.size() <= 1;
|
||||
if (resourceDir.size() == 0) {
|
||||
|
|
|
@ -18,7 +18,8 @@ import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
apply plugin: 'elasticsearch.internal-cluster-test'
|
||||
|
||||
esplugin {
|
||||
description 'The ICU Analysis plugin integrates the Lucene ICU module into Elasticsearch, adding ICU-related analysis components.'
|
||||
|
@ -26,7 +27,7 @@ esplugin {
|
|||
hasClientJar = true
|
||||
}
|
||||
|
||||
tasks.withType(CheckForbiddenApis).configureEach {
|
||||
forbiddenApisMain {
|
||||
signatures += [
|
||||
"com.ibm.icu.text.Collator#getInstance() @ Don't use default locale, use getInstance(ULocale) instead"
|
||||
]
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
|
||||
esplugin {
|
||||
description 'The Japanese (kuromoji) Analysis plugin integrates Lucene kuromoji analysis module into elasticsearch.'
|
||||
|
@ -32,7 +32,6 @@ restResources {
|
|||
includeCore '_common', 'indices', 'index', 'search'
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("dependencyLicenses").configure {
|
||||
mapping from: /lucene-.*/, to: 'lucene'
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
|
||||
esplugin {
|
||||
description 'The Korean (nori) Analysis plugin integrates Lucene nori analysis module into elasticsearch.'
|
||||
|
@ -32,6 +32,7 @@ restResources {
|
|||
includeCore '_common', 'indices', 'index', 'search'
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("dependencyLicenses").configure {
|
||||
mapping from: /lucene-.*/, to: 'lucene'
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
|
||||
esplugin {
|
||||
description 'The Phonetic Analysis plugin integrates phonetic token filter analysis with elasticsearch.'
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
|
||||
esplugin {
|
||||
description 'Smart Chinese Analysis plugin integrates Lucene Smart Chinese analysis module into elasticsearch.'
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
|
||||
esplugin {
|
||||
description 'The Stempel (Polish) Analysis plugin integrates Lucene stempel (polish) analysis module into elasticsearch.'
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
|
||||
esplugin {
|
||||
description 'The Ukrainian Analysis plugin integrates the Lucene UkrainianMorfologikAnalyzer into elasticsearch.'
|
||||
|
|
|
@ -16,9 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.esplugin'
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
|
||||
esplugin {
|
||||
name 'custom-settings'
|
||||
|
@ -28,7 +27,8 @@ esplugin {
|
|||
noticeFile rootProject.file('NOTICE.txt')
|
||||
}
|
||||
|
||||
testClusters.integTest {
|
||||
testClusters.all {
|
||||
// Adds a setting in the Elasticsearch keystore before running the integration tests
|
||||
keystore 'custom.secured', 'password'
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
|
@ -26,11 +26,11 @@ import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
|||
/**
|
||||
* {@link ExampleCustomSettingsClientYamlTestSuiteIT} executes the plugin's REST API integration tests.
|
||||
* <p>
|
||||
* The tests can be executed using the command: ./gradlew :example-plugins:custom-settings:check
|
||||
* The tests can be executed using the command: ./gradlew :example-plugins:custom-settings:yamlRestTest
|
||||
* <p>
|
||||
* This class extends {@link ESClientYamlSuiteTestCase}, which takes care of parsing the YAML files
|
||||
* located in the src/test/resources/rest-api-spec/test/ directory and validates them against the
|
||||
* custom REST API definition files located in src/test/resources/rest-api-spec/api/.
|
||||
* located in the src/yamlRestTest/resources/rest-api-spec/test/ directory and validates them against the
|
||||
* custom REST API definition files located in src/yamlRestTest/resources/rest-api-spec/api/.
|
||||
* <p>
|
||||
* Once validated, {@link ESClientYamlSuiteTestCase} executes the REST tests against a single node
|
||||
* integration cluster which has the plugin already installed by the Gradle build script.
|
|
@ -16,9 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.esplugin'
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
|
||||
esplugin {
|
||||
name 'custom-significance-heuristic'
|
||||
|
|
|
@ -16,9 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.esplugin'
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
|
||||
esplugin {
|
||||
name 'custom-suggester'
|
||||
|
@ -28,7 +27,7 @@ esplugin {
|
|||
noticeFile rootProject.file('NOTICE.txt')
|
||||
}
|
||||
|
||||
testClusters.integTest {
|
||||
testClusters.all {
|
||||
numberOfNodes = 2
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.esplugin'
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
|
||||
esplugin {
|
||||
name 'painless-whitelist'
|
||||
|
@ -33,7 +32,7 @@ dependencies {
|
|||
compileOnly "org.elasticsearch.plugin:elasticsearch-scripting-painless-spi:${versions.elasticsearch}"
|
||||
}
|
||||
|
||||
testClusters.integTest {
|
||||
testClusters.all {
|
||||
testDistribution = 'oss'
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.esplugin'
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
|
||||
esplugin {
|
||||
name 'example-rescore'
|
||||
|
@ -27,4 +26,3 @@ esplugin {
|
|||
licenseFile rootProject.file('licenses/APACHE-LICENSE-2.0.txt')
|
||||
noticeFile rootProject.file('NOTICE.txt')
|
||||
}
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ import org.elasticsearch.gradle.info.BuildParams
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.esplugin'
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
apply plugin: 'elasticsearch.java-rest-test'
|
||||
|
||||
esplugin {
|
||||
name 'rest-handler'
|
||||
|
@ -34,21 +34,16 @@ esplugin {
|
|||
test.enabled = false
|
||||
|
||||
tasks.register("exampleFixture", org.elasticsearch.gradle.test.AntFixture) {
|
||||
dependsOn testClasses
|
||||
env 'CLASSPATH', "${-> project.sourceSets.test.runtimeClasspath.asPath}"
|
||||
dependsOn sourceSets.javaRestTest.runtimeClasspath
|
||||
env 'CLASSPATH', "${-> project.sourceSets.javaRestTest.runtimeClasspath.asPath}"
|
||||
executable = "${BuildParams.runtimeJavaHome}/bin/java"
|
||||
args 'org.elasticsearch.example.resthandler.ExampleFixture', baseDir, 'TEST'
|
||||
}
|
||||
|
||||
integTest {
|
||||
javaRestTest {
|
||||
dependsOn exampleFixture
|
||||
runner {
|
||||
nonInputProperties.systemProperty 'external.address', "${-> exampleFixture.addressAndPort}"
|
||||
}
|
||||
}
|
||||
|
||||
testingConventions.naming {
|
||||
IT {
|
||||
baseClass 'org.elasticsearch.test.ESTestCase'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,11 +26,11 @@ import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
|||
/**
|
||||
* {@link ExampleRestHandlerClientYamlTestSuiteIT} executes the plugin's REST API integration tests.
|
||||
* <p>
|
||||
* The tests can be executed using the command: ./gradlew :example-plugins:rest-handler:check
|
||||
* The tests can be executed using the command: ./gradlew :example-plugins:rest-handler:yamlRestTest
|
||||
* <p>
|
||||
* This class extends {@link ESClientYamlSuiteTestCase}, which takes care of parsing the YAML files
|
||||
* located in the src/test/resources/rest-api-spec/test/ directory and validates them against the
|
||||
* custom REST API definition files located in src/test/resources/rest-api-spec/api/.
|
||||
* located in the src/yamlRestTest/resources/rest-api-spec/test/ directory and validates them against the
|
||||
* custom REST API definition files located in src/yamlRestTest/resources/rest-api-spec/api/.
|
||||
* <p>
|
||||
* Once validated, {@link ESClientYamlSuiteTestCase} executes the REST tests against a single node
|
||||
* integration cluster which has the plugin already installed by the Gradle build script.
|
|
@ -16,9 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.esplugin'
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
|
||||
esplugin {
|
||||
name 'script-expert-scoring'
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
apply plugin: 'elasticsearch.testclusters'
|
||||
apply plugin: 'elasticsearch.esplugin'
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.java-rest-test'
|
||||
|
||||
esplugin {
|
||||
name 'security-authorization-engine'
|
||||
|
@ -13,17 +12,21 @@ esplugin {
|
|||
|
||||
dependencies {
|
||||
compileOnly "org.elasticsearch.plugin:x-pack-core:${versions.elasticsearch}"
|
||||
testImplementation "org.elasticsearch.client:x-pack-transport:${versions.elasticsearch}"
|
||||
javaRestTestImplementation "org.elasticsearch.client:x-pack-transport:${versions.elasticsearch}"
|
||||
javaRestTestImplementation "org.elasticsearch.plugin:x-pack-core:${versions.elasticsearch}"
|
||||
// let the javaRestTest see the classpath of main
|
||||
javaRestTestImplementation project.sourceSets.main.runtimeClasspath
|
||||
}
|
||||
|
||||
integTest {
|
||||
//no unit tests
|
||||
test.enabled = false
|
||||
javaRestTest {
|
||||
dependsOn buildZip
|
||||
runner {
|
||||
systemProperty 'tests.security.manager', 'false'
|
||||
}
|
||||
}
|
||||
|
||||
testClusters.integTest {
|
||||
testClusters.javaRestTest {
|
||||
setting 'xpack.security.enabled', 'true'
|
||||
setting 'xpack.ml.enabled', 'false'
|
||||
setting 'xpack.license.self_generated.type', 'trial'
|
||||
|
@ -36,4 +39,3 @@ testClusters.integTest {
|
|||
user role: 'custom_superuser'
|
||||
}
|
||||
|
||||
check.dependsOn integTest
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.elasticsearch.gradle.info.BuildParams
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
|
||||
esplugin {
|
||||
description 'Ingest processor that uses Apache Tika to extract contents'
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
apply plugin: 'elasticsearch.internal-cluster-test'
|
||||
|
||||
esplugin {
|
||||
description 'The Mapper Annotated_text plugin adds support for text fields with markup used to inject annotation tokens into the index.'
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
apply plugin: 'elasticsearch.internal-cluster-test'
|
||||
|
||||
esplugin {
|
||||
description 'The Mapper Murmur3 plugin allows to compute hashes of a field\'s values at index-time and to store them in the index.'
|
||||
|
@ -28,3 +29,5 @@ restResources {
|
|||
includeCore '_common', 'indices', 'index', 'search'
|
||||
}
|
||||
}
|
||||
// no unit tests
|
||||
test.enabled = false
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
apply plugin: 'elasticsearch.internal-cluster-test'
|
||||
|
||||
esplugin {
|
||||
description 'The Mapper Size plugin allows document to record their uncompressed size at index time.'
|
||||
|
@ -28,3 +29,5 @@ restResources {
|
|||
includeCore '_common', 'indices', 'index', 'get'
|
||||
}
|
||||
}
|
||||
// no unit tests
|
||||
test.enabled = false
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
apply plugin: 'elasticsearch.rest-resources'
|
||||
apply plugin: 'elasticsearch.yaml-rest-test'
|
||||
apply plugin: 'elasticsearch.internal-cluster-test'
|
||||
|
||||
esplugin {
|
||||
description 'The Store SMB plugin adds support for SMB stores.'
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.elasticsearch.gradle.info.BuildParams
|
|||
* under the License.
|
||||
*/
|
||||
apply plugin: "elasticsearch.publish"
|
||||
apply plugin: 'elasticsearch.internal-cluster-test'
|
||||
|
||||
esplugin {
|
||||
description 'The nio transport.'
|
||||
|
@ -26,6 +27,8 @@ esplugin {
|
|||
hasClientJar = true
|
||||
}
|
||||
|
||||
// integTest have been converted to internalClusterTest
|
||||
integTest.enabled = false
|
||||
dependencies {
|
||||
api project(':libs:elasticsearch-nio')
|
||||
|
||||
|
|
Loading…
Reference in New Issue