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

Fix flakiness of IndexActionIT.testAutoGenerateIdNoDuplicates #17606

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

beanuwave
Copy link
Contributor

@beanuwave beanuwave commented Mar 17, 2025

Description

The test case org.opensearch.indexing.IndexActionIT.testAutoGenerateIdNoDuplicates is flaky.

IndexActionIT > testAutoGenerateIdNoDuplicates {p0={"cluster.indices.replication.strategy":"SEGMENT"}} FAILED
    java.lang.AssertionError: Count is 109 but 83 was expected.  Total shards: 3 Successful shards: 3 & 0 shard failures:
        at __randomizedtesting.SeedInfo.seed([17FD038E1B5EBC1C:24A577DF25F84AED]:0)
        at org.junit.Assert.fail(Assert.java:89)
        at org.opensearch.indexing.IndexActionIT.testAutoGenerateIdNoDuplicates(IndexActionIT.java:125)

Index refresh after creation seems to diminish the chance of wrong counter. For convenience fix was tested with 100 repetitions.

Related Issues

Resolves #16576

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 Mar 17, 2025
Copy link
Contributor

❌ Gradle check result for c8066a0: 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 c8066a0: 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 c8066a0:

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 c8066a0: 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
Collaborator

@gaobinlong gaobinlong left a comment

Choose a reason for hiding this comment

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

The DCO check failed, please amend git commit command with -s and then force push the commit, thank you!

int numberOfIterations = scaledRandomIntBetween(10, 50);
for (int i = 0; i < numberOfIterations; i++) {
Exception firstError = null;
createIndex("test");
createIndex(testIndex);
var refRsp = client().admin().indices().refresh(new RefreshRequest(testIndex)).actionGet();
Copy link
Collaborator

@gaobinlong gaobinlong Mar 20, 2025

Choose a reason for hiding this comment

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

Refresh the index after the index creation doesn't help, I think, there're no documents in the index, refresh takes no effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can imagine if the async deletion isn’t fully completed, remnants of previous runs may still be visible. This can result in search queries returning a higher total hit count.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you mean by async deletion? createIndex() ensures the old index is deleted and new index is created.

Signed-off-by: Igonin <[email protected]>
Co-authored-by: Benny Goerzig <[email protected]>
Co-authored-by: Karsten Schnitter <[email protected]>
Co-authored-by: Kai Sternad <[email protected]>
Copy link
Contributor

❕ Gradle check result for e0f5ae8: UNSTABLE

  • TEST FAILURES:
      2 org.opensearch.repositories.s3.S3BlobStoreRepositoryTests.classMethod

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 Mar 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.45%. Comparing base (af5835f) to head (e0f5ae8).

Additional details and impacted files
@@            Coverage Diff            @@
##               main   #17606   +/-   ##
=========================================
  Coverage     72.44%   72.45%           
+ Complexity    65732    65718   -14     
=========================================
  Files          5311     5311           
  Lines        305011   305011           
  Branches      44232    44232           
=========================================
+ Hits         220969   220982   +13     
+ Misses        65967    65914   -53     
- Partials      18075    18115   +40     

☔ 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.

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 >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 IndexActionIT
3 participants