Skip to content

Conversation

@andrross
Copy link
Member

Description

This commit introduces enforcement to cause any future usage of Thread.sleep within :server:internalClusterTest to fail by default. It can still be overridden when necessary by using @SuppressForbidden.

For the existing usages of Thread.sleep(), I have either annotated them with some sort of rationale, replaced them with a polling alternative, or just removed them all together. I ran ./gradlew :server:internalClusterTest 100 times over the weekend, and while it failed nearly half the time, none of the tests modified here were implicated.

Related Issues

Related to #20004

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.

@github-actions
Copy link
Contributor

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

@reta reta left a comment

Choose a reason for hiding this comment

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

Nice cleanup, thanks @andrross !

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

Signed-off-by: Andrew Ross <andrross@amazon.com>
@github-actions
Copy link
Contributor

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

Copy link
Contributor

@jainankitk jainankitk left a comment

Choose a reason for hiding this comment

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

Seems like a reasonable expectation to not use Thread.sleep as part of tests!

@github-actions
Copy link
Contributor

✅ Gradle check result for cbdb02f: SUCCESS

@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.30%. Comparing base (97d3864) to head (cbdb02f).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...gradle/precommit/ForbiddenApisPrecommitPlugin.java 0.00% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #20088      +/-   ##
============================================
- Coverage     73.33%   73.30%   -0.04%     
+ Complexity    71679    71667      -12     
============================================
  Files          5790     5790              
  Lines        327549   327667     +118     
  Branches      47181    47204      +23     
============================================
- Hits         240217   240181      -36     
- Misses        68080    68197     +117     
- Partials      19252    19289      +37     

☔ 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 merged commit 55f1f5e into opensearch-project:main Nov 26, 2025
33 of 36 checks passed
@andrross andrross deleted the forbid-sleep branch November 26, 2025 16:57
kkewwei pushed a commit to kkewwei/OpenSearch that referenced this pull request Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog :test Adding or fixing a test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants