-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add REST high level client gradle submodule and first simple method #22371
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 REST high level client gradle submodule and first simple method #22371
Conversation
|
@elasticmachine retest this please |
|
@nik9000 can you check out if the new gradle submodule works ok with eclipse please? I suspect it doesn't, in which case, do you know what we may have forgotten in the gradle conf? |
|
In Eclipse this isn't importing the "main" classes, only the test classes. this fixes it, but it isn't super clear to me why we haven't hit this before. If we have, we work around it in some way I haven't yet seen. |
client/rest-high-level/build.gradle
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is meant to be for a standalone test, not adding a rest test to an existing project. It's possible your changes to standalone test make this work, but it seems a little wonky to me. This may be the reason for the eclipse behavior Nik described.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I don't know anything about these gradle changes, I just took what we had in the feature branch, I thought that you and Tanguy had already worked together on it. Could you let me know what else I should be doing instead please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not knowing much about gradle and the build setup really, but in my initial commit in the feature branch I only used the elasticsearch.build plugin and added the integTest task manually (ecf6af8) but this very likely wasn't the best approach either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only comment I haven't addressed yet, as I am not clear on what should be done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the trouble is https://github.com/elastic/elasticsearch/blob/master/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneTestBasePlugin.groovy#L46-L49
I think if we want to repurpose RestTestPlugin so it can be applied to projects with a main class we should do something like:
- project.pluginManager.apply(StandaloneTestBasePlugin)
+ if (false == project.pluginManager.hasPlugin('elasticsearch.build')) {
+ project.pluginManager.apply(StandaloneTestBasePlugin)
+ }
Or maybe just:
- project.pluginManager.apply(StandaloneTestBasePlugin)
+ if (false == project.pluginManager.hasPlugin('elasticsearch.build') && false == project.pluginManager.hasPlugin('elasticsearch.standalone-test')) {
+ throw new InvalidUserDataException('elasticsearch.rest-test requires either elasticsearch.build or elasticsearch.standalone-test')
+ }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rjernst are you ok with what Nik is proposing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it sounds good I'm happy to make the change and add a commit to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with what Nik proposes. It would mean the tests we have under qa right now need to add apply plugin: 'elasticsearch.standalone-test'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that is the plan. I'll have a look at it soon!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a commit that does the bottom option: now elasticsearch.rest-test requires either elasticsearch.build or elasticsearch.standalone-test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: can this helper method get some comment about what the arguments mean? They are named appropriately I think but some short explanation would make reuse easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to be able to specify the number as the "generate" method was able before? If not the comment should be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: arrayName is not used here any more, not sure if we need it, if not remove from comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also mentioned below, I don't know which purpose array name ("Header-array") served here before, just curious to see why its gone (unnecessary?).
client/rest-high-level/build.gradle
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not knowing much about gradle and the build setup really, but in my initial commit in the feature branch I only used the elasticsearch.build plugin and added the integTest task manually (ecf6af8) but this very likely wasn't the best approach either.
29011a0 to
7500ab9
Compare
|
@cbuescher thanks for the review, your comments were all spot-on, I addressed them with the last commit |
e1cf74e to
5f5084c
Compare
|
retest this please |
5f5084c to
126281e
Compare
|
@javanna I think I fixed it. |
…tTestUtil and simplify headers assertions
The RestHighLevelClient class takes as as an argument a low level client instance RestClient. The first method added is ping, which returns true if the call to HEAD / went ok and false if an IOException was thrown. Any other exception gets bubbled up. There are two kinds of tests, a unit test (RestHighLevelClientTests) that verifies the interaction between high level and low level client, and an integration test (MainActionIT) which relies on an externally started es cluster to send requests to.
…tPlugin It used to be that RestTestPlugin "came with" StandaloneTestBasePlugin but we'd like to use it with BuildPlugin for the high level rest client.
standalone-rest-test doesn't configure unit tests and for these integ test only tests, that is what we want.
|
@nik9000 thanks a lot, all good now, going to push. |
126281e to
326f6ca
Compare
|
I am wondering if we should backport the gradle changes, not the the new submodule for now, to 5.x. That will make backporting the submodule easier when ready. Thoughts @nik9000 ? |
|
I'm certainly OK with it.
…On Thu, Jan 5, 2017, 4:58 AM Luca Cavanna ***@***.***> wrote:
I am wondering if we should backport the gradle changes, not the the new
submodule for now, to 5.x. That will make backporting the submodule easier
when ready. Thoughts @nik9000 <https://github.com/nik9000> ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#22371 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AANLoqXn7mAgM_XgfA-KN7tO1Zc2_EYDks5rPL6vgaJpZM4LXuRw>
.
|
The
RestHighLevelClientclass takes as as an argument a low level client instance (RestClient). The first method added isping, which returns true if the call to HEAD / went ok and false if an IOException was thrown. Any other exception gets bubbled up.There are two kinds of tests, a unit test (
RestHighLevelClientTests) that verifies the interaction between high level and low level client, and an integration test (MainActionIT) which relies on an externally started es cluster to send requests to.This PR essentially holds the current content of the feature/high-level-rest-client public branch. We decided to add parsing code to java api responses directly upstream. Also we can add new methods to the high level rest client as we go without the need to maintain a separate branch. The important part is that we don't release/publish any artifact until we are ready to do so.