-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Make ingest pipeline resolution logic unit testable #47026
Conversation
Extracted ingest pipeline resolution logic into a static method and added unit tests for pipeline resolution logic. Followup from elastic#46847
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.
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.
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; |
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.
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).
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 hate that we mutate like this by the way, but it is what it is for now. 🤷♀
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... not very clean 🤷♂
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 #46847