-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Fixing ComposableIndexTemplateTests #130052
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
base: main
Are you sure you want to change the base?
Conversation
Pinging @elastic/es-data-management (Team:Data Management) |
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.
Pull Request Overview
This PR updates the testMergeEmptyMappingsIntoTemplateWithNonEmptySettings
to handle cases where the existing template or its mappings are null, and re-enables the test in muted-tests.yml
now that it passes.
- Adjusted the test to assert the new
EMPTY_MAPPINGS
behavior whentemplate()
ortemplate().mappings()
is null. - Restored the test in
muted-tests.yml
by removing its muted entries.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
server/src/test/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplateTests.java | Added conditional assertions for the null-template or null-mappings scenarios in mergeMappings . |
muted-tests.yml | Removed the muted entry to unmute testMergeEmptyMappingsIntoTemplateWithNonEmptySettings . |
Comments suppressed due to low confidence (1)
server/src/test/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplateTests.java:351
- [nitpick] Consider splitting this randomized test into two separate, deterministic test methods—one covering the null-template/null-mappings path and another covering the non-null path—to make failures easier to diagnose and ensure clear coverage.
public void testMergeEmptyMappingsIntoTemplateWithNonEmptySettings() throws IOException {
server/src/test/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplateTests.java
Outdated
Show resolved
Hide resolved
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.
Bar copilot's comment, LGTM 👍🏻
Don't forget to close #130050 when you merge. |
ComposableIndexTemplateTests::testMergeEmptyMappingsIntoTemplateWithNonEmptySettings fails when indexTemplate.template() is null or indexTemplate.template().mappings() is null, because ComposableIndexTemplate::mergeMappings intentionally sets the mapping to EMPTY_MAPPING if you pass in EMPTY_MAPPING when the template or the template mappings are null. This fixes the test to account for that.
This was introduced by #129787.
Closes #130050