Skip to content

Fix flaky test RemoteSegmentTransferTrackerTests.testGetInflightUploadBytes #17128

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

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

sachinpkale
Copy link
Member

Description

  • In RemoteSegmentTransferTrackerTests.testGetInflightUploadBytes, we get random value for started, succeeded and failed bytes with following logic:

    long bytesStarted = randomLongBetween(10000, 100000);
    long bytesSucceeded = randomLongBetween(1000, 10000);
    long bytesFailed = randomLongBetween(100, 1000);

  • Here, the expectation is, started >= failed + succeeded. We assert with following check:

    private void checkTotal(long startedCount, long failedCount, long succeededCount, long countToAdd) {
    long delta = startedCount - (failedCount + succeededCount + countToAdd);
    assert delta >= 0 : "Sum of failure count ("
    + failedCount
    + "), success count ("
    + succeededCount
    + "), and count to add ("
    + countToAdd
    + ") cannot exceed started count ("
    + startedCount
    + ")";
    }

  • But while assigning random value, it is possible to assign following values which breaks the above assertion:

    • started = 10200
    • succeeded = 9900
    • failed = 8000
  • To make sure the assertion never fails, in this PR, we change the lower bound of started to 12000.

Related Issues

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.

…dBytes

Signed-off-by: Sachin Kale <sachinpkale@gmail.com>
Copy link
Contributor

✅ Gradle check result for d5589dd: SUCCESS

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.27%. Comparing base (931c1aa) to head (d5589dd).
Report is 7 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #17128      +/-   ##
============================================
- Coverage     72.30%   72.27%   -0.04%     
+ Complexity    65482    65459      -23     
============================================
  Files          5309     5309              
  Lines        304324   304347      +23     
  Branches      44132    44141       +9     
============================================
- Hits         220056   219966      -90     
- Misses        66259    66333      +74     
- Partials      18009    18048      +39     

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

@linuxpi linuxpi merged commit 7e51088 into opensearch-project:main Jan 27, 2025
54 of 55 checks passed
@linuxpi linuxpi added the backport 2.x Backport to 2.x branch label Jan 27, 2025
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 27, 2025
…dBytes (#17128)

Signed-off-by: Sachin Kale <sachinpkale@gmail.com>
(cherry picked from commit 7e51088)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ashking94 pushed a commit that referenced this pull request Jan 27, 2025
…dBytes (#17128) (#17129)

(cherry picked from commit 7e51088)

Signed-off-by: Sachin Kale <sachinpkale@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
etolbakov pushed a commit to etolbakov/OpenSearch that referenced this pull request Jan 29, 2025
…dBytes (opensearch-project#17128)

Signed-off-by: Sachin Kale <sachinpkale@gmail.com>
Signed-off-by: Eugene Tolbakov <ev.tolbakov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants