Skip to content

Conversation

@javanna
Copy link
Member

@javanna javanna commented Dec 29, 2016

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.

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.

@javanna
Copy link
Member Author

javanna commented Dec 30, 2016

@elasticmachine retest this please

@javanna
Copy link
Member Author

javanna commented Dec 30, 2016

@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?

@nik9000
Copy link
Member

nik9000 commented Dec 30, 2016

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.

Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

@nik9000 nik9000 Jan 3, 2017

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')
+ }

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member

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'.

Copy link
Member

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!

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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?).

Copy link
Member

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.

@javanna javanna force-pushed the enhancement/rest_high_level_client branch from 29011a0 to 7500ab9 Compare January 3, 2017 13:22
@javanna
Copy link
Member Author

javanna commented Jan 3, 2017

@cbuescher thanks for the review, your comments were all spot-on, I addressed them with the last commit

@javanna javanna force-pushed the enhancement/rest_high_level_client branch from e1cf74e to 5f5084c Compare January 4, 2017 11:30
@javanna
Copy link
Member Author

javanna commented Jan 4, 2017

retest this please

@nik9000 nik9000 force-pushed the enhancement/rest_high_level_client branch from 5f5084c to 126281e Compare January 5, 2017 02:15
@nik9000
Copy link
Member

nik9000 commented Jan 5, 2017

@javanna I think I fixed it.

javanna and others added 4 commits January 5, 2017 10:48
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.
@javanna
Copy link
Member Author

javanna commented Jan 5, 2017

@nik9000 thanks a lot, all good now, going to push.

@javanna javanna force-pushed the enhancement/rest_high_level_client branch from 126281e to 326f6ca Compare January 5, 2017 09:54
@javanna javanna merged commit 232af51 into elastic:master Jan 5, 2017
@javanna
Copy link
Member Author

javanna commented Jan 5, 2017

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 ?

@nik9000
Copy link
Member

nik9000 commented Jan 5, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants