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

Remove UpdateSettingsTestHelper class #32557

Conversation

dakrone
Copy link
Member

@dakrone dakrone commented Aug 1, 2018

By making the settings() method public on UpdateSettingsRequest (I think it
should have been in the first place) we can get rid of this class entirely. Mock
response objects are now constructed by parsing JSON without making the
constructor public.

Relates to #29823

By making the `settings()` method public on `UpdateSettingsRequest` (I think it
should have been in the first place) we can get rid of this class entirely. Mock
response objects are now constructed by parsing JSON without making the
constructor public.

Relates to elastic#29823
@dakrone dakrone added the :Data Management/ILM+SLM Index and Snapshot lifecycle management label Aug 1, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

final UpdateSettingsResponse response;
try (XContentParser parser = XContentType.JSON.xContent()
.createParser(NamedXContentRegistry.EMPTY, THROW_UNSUPPORTED_OPERATION, "{\"acknowledged\": true}")) {
response = UpdateSettingsResponse.fromXContent(parser);
Copy link
Contributor

Choose a reason for hiding this comment

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

😄

Copy link
Contributor

@talevy talevy Aug 1, 2018

Choose a reason for hiding this comment

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

I ended up using the UpdateSettingsAction.INSTANCE.newResponse() then response.readFrom(StreamInput.wrap(new byte[] { ... })) route for this workaround. But I like this better! more self-describing

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we not make the Response constructor public here? Having the object parsed from a JSON string seems fragile and ugly to me.

Copy link
Contributor

@colings86 colings86 left a comment

Choose a reason for hiding this comment

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

I'm not sure about having the response parsed from a JSON string, it feels ugly to me and IMO more ugly than having the UpdateSettingsTestHelper class. I'm wondering if we can't just make the Response constructor public?

Copy link
Contributor

@colings86 colings86 left a comment

Choose a reason for hiding this comment

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

LGTM

@dakrone dakrone merged commit 0a9c3ae into elastic:index-lifecycle Aug 6, 2018
jasontedor pushed a commit that referenced this pull request Aug 17, 2018
* Remove UpdateSettingsTestHelper class

By making the `settings()` method public on `UpdateSettingsRequest` (I think it
should have been in the first place) we can get rid of this class entirely. Mock
response objects are now constructed by parsing JSON without making the
constructor public.

Relates to #29823
@dakrone dakrone deleted the ilm-remove-update-settings-test-helper branch February 4, 2019 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/ILM+SLM Index and Snapshot lifecycle management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants