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

Add TestWithDependenciesPlugin to build #22646

Merged
merged 5 commits into from
Jan 19, 2017

Conversation

Tim-Brooks
Copy link
Contributor

@Tim-Brooks Tim-Brooks commented Jan 16, 2017

This commit adds a TestWithDependenciesPlugin to the gradle build.
The main piece of functionality that it adds is to copy plugin-metadata
from dependencies into the generated-resources for the current test source.
This is necessary to ensure that permissions for dependencies are applied
when running the tests.

A current limitation is that the permissions are applied differently
than in the distribution sources. When permissions are granted to all
depedencies for a module or plugin, the permissions are granted to all
dependencies on the classpath for tests besides a few hardcoded
exclusions:

  • es core
  • es test framework
  • lucene test framework
  • randomized runner
  • junit library

This commit adds a MessyRestTestPlugin to the gradle build. It extends
StandaloneRestTestPlugin. The main piece of functionality that it adds
is to copy plugin-metadata from dependencies into the
generated-resources for the current test source. This is necessary to
ensure that permissions for dependencies are applied when running the
tests.

A current limitation is that the permissions are applied differently
than in the distribution sources. When permissions are granted to all
depedencies for a module or plugin, the permissions are granted to all
dependencies on the classpath for tests besides a few hardcoded
exclusions:
- es core
- es test framework
- lucene test framework
- randomized runner
- junit library
@Tim-Brooks Tim-Brooks added :Delivery/Build Build or test infrastructure >test Issues or PRs that are addressing/adding tests v6.0.0-alpha1 labels Jan 16, 2017
@javanna
Copy link
Member

javanna commented Jan 17, 2017

can we have the name reflect what it does? I guess this thing does something other than being messy :)

@Tim-Brooks
Copy link
Contributor Author

I named it following the pattern from the preexisting code. We already have a non-rest version. So I just took that convention.

Is there something else you have in mind? RestTestWithDependenciesPlugin? RestTestWithESDependenciesPlugin? NonStandaloneRestTestPlugin?

@javanna
Copy link
Member

javanna commented Jan 17, 2017

Is there something else you have in mind?

not really, everything you are proposing sounds good to me.

@Tim-Brooks Tim-Brooks changed the title Add MessyRestTestPlugin to build Add RestTestWithDependenciesPlugin to build Jan 18, 2017
@rjernst
Copy link
Member

rjernst commented Jan 18, 2017

Why do we need a new plugin? Can we just tweak the behavior of the existing standalone-rest-test plugin?

@Tim-Brooks
Copy link
Contributor Author

Tim-Brooks commented Jan 18, 2017

Well - specifically I had modeled this PR on the relationship between MessyTestPlugin and StandaloneTestPlugin. It looks to me that MessyTestPlugin just extends StandaloneTestPlugin and adds the copying of dependency resources.

@nik9000 told me that there was more reasons for the original MessyTestPlugin.

One thing of note is that some modules which do not need/use the standalone-rest-test plugin (reindex which depends on transport-netty4 for testing) could use the functionality of copying resources of dependencies. Another approach that I had considered taking is not extending standalone-rest-test plugin and just creating a plugin to copy the resources. And that plugin can be applied as need be with no relation to other test plugins.

Or I could just modify the standalone-rest-test plugin. But then I would need a way to add this functionality eventually to tests that do not use that plugin.

@rjernst
Copy link
Member

rjernst commented Jan 18, 2017

Another approach that I had considered taking is not extending standalone-rest-test plugin and just creating a plugin to copy the resources

I think this would be a good approach, as it would fit with the gradle model of making plugins to do one thing, and it would isolate the messiness.

@@ -32,6 +32,7 @@ import org.gradle.api.Project
public class RestTestPlugin implements Plugin<Project> {
List REQUIRED_PLUGINS = [
'elasticsearch.build',
'elasticsearch.rest-test-with-dependencies',
Copy link
Member

Choose a reason for hiding this comment

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

This should be elasticsearch.test-with-dependencies?

Copy link
Contributor Author

@Tim-Brooks Tim-Brooks Jan 18, 2017

Choose a reason for hiding this comment

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

Thanks for pointing this out. I actually think that "test-with-dependencies" should not be in that list anymore. As it has no relation to the RestTestPlugin anymore.

import org.gradle.api.tasks.Copy

/**
* A plugin to run messy REST tests. Messy tests are tests that depend on another
Copy link
Member

Choose a reason for hiding this comment

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

Update javadocs? This is not longer just for rest tests?

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'll do that in just a minute. I'll also update the description of the PR to better reflect that changes.

@Tim-Brooks Tim-Brooks changed the title Add RestTestWithDependenciesPlugin to build Add TestWithDependenciesPlugin to build Jan 18, 2017
@Tim-Brooks Tim-Brooks merged commit a10aa8a into elastic:master Jan 19, 2017
@Tim-Brooks Tim-Brooks deleted the add_messy_tests_for_integration branch January 19, 2017 15:43
nik9000 added a commit that referenced this pull request Jan 19, 2017
The new plugin causes Eclipse to go a bit crazy. So we skip it
for Eclipse.

Relates to #22646
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Jan 20, 2017
* master: (117 commits)
  Add missing serialization BWC for disk usage estimates
  Expose disk usage estimates in nodes stats
  S3 repository: Deprecate specifying credentials through env vars, sys props, and remove profile files (elastic#22567)
  Fix Eclipse project generation
  Fix deprecation logging for lenient booleans
  Remove @Header we no longer need
  Make lexer abstract
  [Docs] Remove outdated info about enabling/disabling doc_values (elastic#22694)
  Move lexer hacks to EnhancedPainlessLexer
  Fix incorrect args order passed to createAggregator
  Improve painless's javadocs
  Add TestWithDependenciesPlugin to build (elastic#22646)
  Add parsing from xContent to SearchProfileShardResults and nested classes (elastic#22649)
  Add unit tests for FiltersAggregator (elastic#22678)
  Don't register search response listener in transport clients
  unmute FieldStatsIntegrationIT.testGeoPointNotIndexed, fix already pushed
  Mute FieldStatsIntegrationIT.testGeoPointNotIndexed, for now
  Painless: Add augmentation to string for base 64 (elastic#22665)
  Fix NPE on FieldStats with mixed cluster on version pre/post 5.2 (elastic#22688)
  Add parsing methods for UpdateResponse (elastic#22586)
  ...
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team >test Issues or PRs that are addressing/adding tests v6.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants