Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert most OSS plugins from integTest to [yaml | java]RestTest or internalClusterTest #59444

Merged
merged 32 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
376db42
start of migration
jakelandis Jul 11, 2020
1e56bb3
fix annoyning bug
jakelandis Jul 11, 2020
424fd5e
more conversion, ignore repository and store for now
jakelandis Jul 13, 2020
5fd84d2
Merge remote-tracking branch 'upstream/master' into yamlRestTest_plugins
jakelandis Jul 13, 2020
aa96ed8
remove temporary code
jakelandis Jul 13, 2020
dfebc85
remove unecessary todo
jakelandis Jul 13, 2020
2be2c71
remove unecessary todo
jakelandis Jul 13, 2020
c603b80
remove rouge plugin defintion
jakelandis Jul 13, 2020
bbc08f9
Merge branch 'master' into yamlRestTest_plugins
jakelandis Jul 21, 2020
a9a34d9
remove (now) unneccessary integTest.enabled=false
jakelandis Jul 21, 2020
5c75412
fix forbiden API and move test
jakelandis Jul 21, 2020
2fab21b
more migration
jakelandis Jul 22, 2020
cc09550
finish examples
jakelandis Jul 22, 2020
cd76cf4
more
jakelandis Jul 22, 2020
4a2d639
repository-azure
jakelandis Jul 22, 2020
8682017
repository-gcs
jakelandis Jul 22, 2020
4a1d8c8
repository-s3
jakelandis Jul 22, 2020
9414e3d
store-smb
jakelandis Jul 22, 2020
f2cf390
transport-nio
jakelandis Jul 22, 2020
21cc84a
Revert "repository-s3"
jakelandis Jul 22, 2020
ebb6703
Revert "repository-gcs"
jakelandis Jul 22, 2020
6147473
Revert "repository-azure"
jakelandis Jul 22, 2020
05e9421
Merge remote-tracking branch 'upstream/master' into yamlRestTest_plugins
jakelandis Jul 22, 2020
885c84a
minor
jakelandis Jul 22, 2020
4ea875a
manually rollback discovery-* changes
jakelandis Jul 22, 2020
ea705a5
white space change
jakelandis Jul 22, 2020
c89b5de
more nits
jakelandis Jul 22, 2020
849d19d
runtimeClasspath and unecessary variable
jakelandis Jul 23, 2020
ef34668
remove GradleUtils from build script
jakelandis Jul 23, 2020
7b07432
Merge branch 'master' into yamlRestTest_plugins
elasticmachine Jul 27, 2020
8058400
Merge remote-tracking branch 'upstream/master' into yamlRestTest_plugins
jakelandis Jul 27, 2020
1832e79
Merge remote-tracking branch 'upstream/master' into yamlRestTest_plugins
jakelandis Jul 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private File getTestSourceResourceDir() {
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) {
Expand Down
12 changes: 7 additions & 5 deletions plugins/analysis-icu/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ 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'

esplugin {
description 'The ICU Analysis plugin integrates the Lucene ICU module into Elasticsearch, adding ICU-related analysis components.'
classname 'org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin'
}

tasks.withType(CheckForbiddenApis).configureEach {
signatures += [
"com.ibm.icu.text.Collator#getInstance() @ Don't use default locale, use getInstance(ULocale) instead"
]
tasks.withType(CheckForbiddenApis).configureEach { task ->
if(task.name.contains("YamlRestTest") == false) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is needed since the yamlRestRest does not have access to that class

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be explicit, applying the signature to forbiddanApisMain and forbiddenApisTest, rather than all CheckForbiddenApis tasks? We are likely to continue adding more source sets in the future, so having configuration apply to all source sets would be problematic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 done 5c75412 (#59444) for the main source set (probably not the extra config noise for the test and internalTestCluster source sets)

signatures += [
"com.ibm.icu.text.Collator#getInstance() @ Don't use default locale, use getInstance(ULocale) instead"
]
}
}

dependencies {
Expand Down
4 changes: 3 additions & 1 deletion plugins/analysis-kuromoji/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand All @@ -33,6 +33,8 @@ restResources {
}
}

integTest.enabled = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being disabled?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a plan for ripping the creation of the integTest task out from the PluginBuildPlugin. Otherwise this is going to be necessary for any plugin project that uses only yaml tests. Or tweak our test conventions logic so it doesn't complain about this scenario.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a need to implement a javaRestTest as part of converting these plugins, so (without hacks) can't finish my conversion to yamlRestTest .. Between javaRestTest, yamlRestTest, and internalClusterTest there is no need for integTest to exist anymore. I plan to rip out integTest once all of these are implemented. It won't take long (but my attention is split among a few things at the moment).


tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
}
Expand Down
5 changes: 4 additions & 1 deletion plugins/analysis-nori/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand All @@ -32,6 +32,9 @@ restResources {
includeCore '_common', 'indices', 'index', 'search'
}
}

integTest.enabled = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto. If we need to disable a test, can we have a comment explaining why it is disabled? Someone coming along in the future will have no reason whether this can/should be re-enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't really disabling a test ... it is to avoid the testing conventions from complaining. I would prefer to tweak the testing conventions instead of a lot of redunant comments. I can do that in a separate PR (and remove these in this PR)


tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
}
4 changes: 3 additions & 1 deletion plugins/analysis-phonetic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand All @@ -34,6 +34,8 @@ restResources {
}
}

integTest.enabled = false

tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
}
4 changes: 3 additions & 1 deletion plugins/analysis-smartcn/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand All @@ -33,6 +33,8 @@ restResources {
}
}

integTest.enabled = false

tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
}
Expand Down
4 changes: 3 additions & 1 deletion plugins/analysis-stempel/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand All @@ -33,6 +33,8 @@ restResources {
}
}

integTest.enabled = false

tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
}
4 changes: 3 additions & 1 deletion plugins/analysis-ukrainian/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand All @@ -36,6 +36,8 @@ restResources {
}
}

integTest.enabled = false

tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
mapping from: /morfologik-.*/, to: 'lucene'
Expand Down
5 changes: 4 additions & 1 deletion plugins/discovery-azure-classic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,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 'The Azure Classic Discovery plugin allows to use Azure Classic API for the unicast discovery mechanism'
Expand Down Expand Up @@ -63,6 +63,9 @@ restResources {
includeCore '_common', 'cluster', 'nodes'
}
}

integTest.enabled = false

// needed to be consistent with ssl host checking
String host = InetAddress.getLoopbackAddress().getHostAddress()

Expand Down
4 changes: 3 additions & 1 deletion plugins/discovery-ec2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 'The EC2 discovery plugin allows to use AWS API for the unicast discovery mechanism.'
Expand Down Expand Up @@ -47,6 +47,8 @@ restResources {
}
}

integTest.enabled = false

tasks.named("dependencyLicenses").configure {
mapping from: /aws-java-sdk-.*/, to: 'aws-java-sdk'
mapping from: /jackson-.*/, to: 'jackson'
Expand Down
3 changes: 3 additions & 0 deletions plugins/discovery-ec2/qa/amazon-ec2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
apply plugin: 'elasticsearch.rest-resources'

//TODO: convert to yamlRestTest - fix incompatibilities with standalone-rest-test, will likely need a javaRestTest sourceSet to fix
//apply plugin: 'elasticsearch.yaml-rest-test'

dependencies {
testImplementation project(':plugins:discovery-ec2')
}
Expand Down
4 changes: 3 additions & 1 deletion plugins/discovery-gce/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'elasticsearch.rest-resources'
apply plugin: 'elasticsearch.yaml-rest-test'

esplugin {
description 'The Google Compute Engine (GCE) Discovery plugin allows to use GCE API for the unicast discovery mechanism.'
Expand Down Expand Up @@ -29,6 +29,8 @@ restResources {
}
}

integTest.enabled = false

tasks.named("dependencyLicenses").configure {
mapping from: /google-.*/, to: 'google'
}
Expand Down
7 changes: 4 additions & 3 deletions plugins/examples/custom-settings/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -28,7 +27,9 @@ esplugin {
noticeFile rootProject.file('NOTICE.txt')
}

testClusters.integTest {
testClusters.all {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this needs to be all and not just yamlRestTest? Isn't there just one test cluster in play here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured the best example would be to use all , I think that should be the go-to configuration unless you need task specific config. (given the ease and cache behavior). Not a strong opinion however.

// Adds a setting in the Elasticsearch keystore before running the integration tests
keystore 'custom.secured', 'password'
}

integTest.enabled = false
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,11 +26,11 @@
/**
* {@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.
Expand Down
5 changes: 3 additions & 2 deletions plugins/examples/custom-significance-heuristic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -27,3 +26,5 @@ esplugin {
licenseFile rootProject.file('licenses/APACHE-LICENSE-2.0.txt')
noticeFile rootProject.file('NOTICE.txt')
}

integTest.enabled = false
6 changes: 3 additions & 3 deletions plugins/examples/custom-suggester/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -28,9 +27,10 @@ esplugin {
noticeFile rootProject.file('NOTICE.txt')
}

testClusters.integTest {
testClusters.all {
numberOfNodes = 2
}

// this plugin has no unit tests, only rest tests
tasks.test.enabled = false
integTest.enabled = false
7 changes: 3 additions & 4 deletions plugins/examples/painless-whitelist/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +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'
Expand All @@ -34,8 +32,9 @@ dependencies {
compileOnly "org.elasticsearch.plugin:elasticsearch-scripting-painless-spi:${versions.elasticsearch}"
}

testClusters.integTest {
testClusters.all {
testDistribution = 'OSS'
}

test.enabled = false
integTest.enabled = false
4 changes: 2 additions & 2 deletions plugins/examples/rescore/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -28,3 +27,4 @@ esplugin {
noticeFile rootProject.file('NOTICE.txt')
}

integTest.enabled = false
3 changes: 1 addition & 2 deletions plugins/examples/rest-handler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ 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'

esplugin {
name 'rest-handler'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
/**
* {@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.
Expand Down
4 changes: 2 additions & 2 deletions plugins/examples/script-expert-scoring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -29,4 +28,5 @@ esplugin {
}

test.enabled = false
integTest.enabled = false

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.esplugin'
apply plugin: 'elasticsearch.rest-resources'
apply plugin: 'elasticsearch.yaml-rest-test'

esplugin {
name 'security-authorization-engine'
Expand Down
4 changes: 3 additions & 1 deletion plugins/ingest-attachment/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -83,6 +83,8 @@ restResources {
}
}

integTest.enabled = false

tasks.named("dependencyLicenses").configure {
mapping from: /apache-mime4j-.*/, to: 'apache-mime4j'
}
Expand Down
Loading