Skip to content

Replace usage of deprecated createIndex() method in tests #18389

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 1 commit into
base: main
Choose a base branch
from

Conversation

andrross
Copy link
Member

The deprecated versions of this method take a type parameter, support for which was removed back in 2.0. The parameter is not used. I have kept the deprecated methods so as to not break downstream components that may be using them but changed all the code in server to stop passing in a type parameter.

Check List

  • Functionality includes testing.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Contributor

❌ Gradle check result for 98664e1: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 98664e1: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@gaobinlong
Copy link
Contributor

❌ Gradle check result for 98664e1: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Seems org.opensearch.index.mapper.size.SizeMappingTests.testSizeNotSet is flaky.

@andrross
Copy link
Member Author

❌ Gradle check result for 98664e1: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Seems org.opensearch.index.mapper.size.SizeMappingTests.testSizeNotSet is flaky.

Previously the code was passing an empty string array as a simple mapping and the new code is passing null in the XContentBuilder argument position. It turns out those are not quite the same. I'll push a fix.

@andrross andrross force-pushed the deprecated-test-create-index branch from 98664e1 to 75c4f47 Compare May 29, 2025 22:31
Copy link
Contributor

❌ Gradle check result for 75c4f47: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 75c4f47: null

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

createIndexRequestBuilder.setMapping(mappings);
}
return createIndex(index, createIndexRequestBuilder);
return createIndexWithSimpleMappings(index, settings, mappings);
Copy link
Member

@sandeshkr419 sandeshkr419 Jun 27, 2025

Choose a reason for hiding this comment

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

I see you have mentioned in description that you are keeping these methods so as not to break any down-streams. But I think we can get rid of them, and let down-streams (if any) change their utilities accordingly.

I wonder if the plugin or any down-streams would be consuming test utils?

We have a good few weeks before 3.2 release, and the changes that any breaking down-streams will have to do will be very minimal.

Realizing that breaking things mid-version might not be a good idea. But at the same time, we should keep a track to remove all the deprecated code during 4.x release.

Copy link
Member Author

Choose a reason for hiding this comment

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

Honestly I think the best way to keep track is to annotate the code properly. The annotations will generate warnings on usage and it's simple to do a search to find all the instances of deprecated code.

Now, actually spending the time to do the work to remove the deprecated things around the next major version release is another story...

@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added the stalled Issues that have stalled label Jul 28, 2025
The deprecated versions of this method take a type parameter, support
for which was removed back in 2.0. The parameter is not used. I have
kept the deprecated methods so as to not break downstream components
that may be using them but changed all the code in server to stop
passing in a type parameter.

Signed-off-by: Andrew Ross <andrross@amazon.com>
@andrross andrross force-pushed the deprecated-test-create-index branch from 75c4f47 to f30c5a8 Compare August 11, 2025 21:15
Copy link
Contributor

✅ Gradle check result for f30c5a8: SUCCESS

Copy link

codecov bot commented Aug 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.88%. Comparing base (64da5f1) to head (f30c5a8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #18389      +/-   ##
============================================
- Coverage     72.91%   72.88%   -0.03%     
+ Complexity    69391    69358      -33     
============================================
  Files          5645     5645              
  Lines        318789   318789              
  Branches      46126    46126              
============================================
- Hits         232442   232348      -94     
- Misses        67551    67691     +140     
+ Partials      18796    18750      -46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andrross andrross removed the stalled Issues that have stalled label Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants