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

Explicitly disable FeatureFlag in MetadataCreateIndexServiceTests.testCreateIndexWithContextDisabled #17384

Merged
merged 6 commits into from
Feb 19, 2025

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented Feb 18, 2025

Description

This PR is an attempt to fix flakiness seen in tests that rely on FeatureFlags being enabled. Unfortunately, the FeatureFlags class relies on static data structures to be available node-wide statically. In a single node, it can be reliable but it becomes an issue for tests since different tests may rely on FeatureFlags being toggled on/off.

This PR ensures that any feature flag toggled on for an individual test is cleared afterwards.

Related Issues

Resolves #17291

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

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.

@github-actions github-actions bot added >test-failure Test failure from CI, local build, etc. autocut flaky-test Random test failure that succeeds on second run labels Feb 18, 2025
Signed-off-by: Craig Perkins <[email protected]>
Copy link
Contributor

❕ Gradle check result for 43fa229: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

Copy link

codecov bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.46%. Comparing base (91a93da) to head (9b622cd).
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #17384      +/-   ##
============================================
+ Coverage     72.38%   72.46%   +0.08%     
- Complexity    65516    65556      +40     
============================================
  Files          5291     5291              
  Lines        304319   304319              
  Branches      44176    44176              
============================================
+ Hits         220269   220513     +244     
+ Misses        65964    65779     -185     
+ Partials      18086    18027      -59     

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

Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
@cwperks cwperks changed the title Segregate tests in MetadataCreateIndexServiceTests that rely on FeatureFlags being enabled Explicitly disable FeatureFlag in MetadataCreateIndexServiceTests.testCreateIndexWithContextDisabled Feb 18, 2025
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
@cwperks
Copy link
Member Author

cwperks commented Feb 18, 2025

Thank you @andrross for helping me understand how the tests are actually run for the gradle check. See #12134 (comment) for more details.

Each test suite is run in a forked JVM and tests are run serially so there's no risk of concurrent modification to static state. Usually these errors indicate improper test cleanup.

I plan to add a section in https://github.com/opensearch-project/OpenSearch/blob/36c89bf4f975bd2750423d1308d2cd3408d8553f/TESTING.md#L2-L1 to describe the test process occurring on the jenkins runners in greater detail.

Copy link
Contributor

❌ Gradle check result for 9b622cd: 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 9b622cd: 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 9b622cd: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@cwperks
Copy link
Member Author

cwperks commented Feb 19, 2025

@reta I've been trying to fix flaky tests that I have seen in dependabot PRs which should be reliably passing CI checks. This is a small one to clear FeatureFlags after each test run.

@andrross andrross merged commit 43e589a into opensearch-project:main Feb 19, 2025
59 of 60 checks passed
@reta
Copy link
Collaborator

reta commented Feb 19, 2025

@reta I've been trying to fix flaky tests that I have seen in dependabot PRs which should be reliably passing CI checks. This is a small one to clear FeatureFlags after each test run.

Sorry @cwperks , but @andrross beat me here :-) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autocut flaky-test Random test failure that succeeds on second run skip-changelog >test-failure Test failure from CI, local build, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[AUTOCUT] Gradle Check Flaky Test Report for MetadataCreateIndexServiceTests
4 participants