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

Make ingest pipeline resolution logic unit testable #47026

Merged

Conversation

martijnvg
Copy link
Member

Extracted ingest pipeline resolution logic into a static method
and added unit tests for pipeline resolution logic.

Followup from #46847

Extracted ingest pipeline resolution logic into a static method
and added unit tests for pipeline resolution logic.

Followup from elastic#46847
@martijnvg martijnvg added >non-issue :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP v8.0.0 v7.5.0 labels Sep 24, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features

…eMatch test

expected that MetaData#indices() is invoked instead of MetaData#getIndices()
method. So changed the resolveRequiredOrDefaultPipeline(...) method to do this.
Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

The tests look great. I left one suggestion. Thanks for picking this up.

indexRequest.isPipelineResolved(true);
} else if (IngestService.NOOP_PIPELINE_NAME.equals(indexRequest.getPipeline()) == false) {
boolean indexRequestHasPipeline = resolveRequiredOrDefaultPipeline(actionRequest, indexRequest, metaData);
if (indexRequestHasPipeline) {
hasIndexRequestsWithPipelines = true;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe replace all of this with hasIndexRequestWithPipelines |= indexRequestHasPipeline. This will short-circuit if hasIndexRequestWithPipelines is already true and the branch predictor will love it. I would suggest that we leave a comment that resolveRequiredOrDefaultPipeline mutates indexRequest so that the method call can not be folded into the expression (we have to evaluate it).

Copy link
Member

Choose a reason for hiding this comment

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

I hate that we mutate like this by the way, but it is what it is for now. 🤷‍♀

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah... not very clean 🤷‍♂

@martijnvg martijnvg merged commit 737376d into elastic:master Sep 25, 2019
martijnvg added a commit that referenced this pull request Sep 25, 2019
Extracted ingest pipeline resolution logic into a static method
and added unit tests for pipeline resolution logic.

Followup from #46847
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >non-issue v7.5.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants