Skip to content

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

masseyke
Copy link
Member

@masseyke masseyke commented Jun 25, 2025

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

@masseyke masseyke added >test Issues or PRs that are addressing/adding tests :Data Management/Data streams Data streams and their lifecycles v9.2.0 labels Jun 25, 2025
@masseyke masseyke requested a review from lukewhiting June 25, 2025 22:43
@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label Jun 25, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@lukewhiting lukewhiting requested a review from Copilot June 26, 2025 08:14
Copy link
Contributor

@Copilot Copilot AI left a 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 when template() or template().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 {

Copy link
Contributor

@lukewhiting lukewhiting left a 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 👍🏻

@nielsbauman
Copy link
Contributor

Don't forget to close #130050 when you merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Data streams Data streams and their lifecycles Team:Data Management Meta label for data/management team >test Issues or PRs that are addressing/adding tests v9.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] ComposableIndexTemplateTests testMergeEmptyMappingsIntoTemplateWithNonEmptySettings failing
4 participants