-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Streamline working of shared thread pools #3207
Conversation
WalkthroughThis pull request updates TestNG’s release notes and core functionality. In the release notes (CHANGES.txt), a new fix for GITHUB-3179 is added, and the fix for GITHUB-2765 is updated with contributor attribution. The Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (6)
⏰ Context from checks skipped due to timeout of 90000ms (6)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
testng-core/src/test/java/test/thread/issue3179/SampleSuiteAlteringListener.java (1)
9-13
: Consider adding null check and bounds check.The implementation looks good, but consider adding defensive checks for the
suites
list to handle edge cases gracefully.@Override public void alter(List<XmlSuite> suites) { + if (suites == null || suites.isEmpty()) { + return; + } suites.get(0).shouldUseGlobalThreadPool(true); suites.get(0).setThreadCount(3); suites.get(0).setParallel(XmlSuite.ParallelMode.METHODS); }testng-core/src/main/java/org/testng/TestRunner.java (1)
715-717
: Verify variable naming for clarity.Consider renaming variables to better reflect their purpose:
determined.first()
indicates multiple interceptorsdetermined.second()
indicates priority differences- Pair<Boolean, Boolean> determined = sortOnPriority(interceptedOrder); - boolean needPrioritySort = determined.first() || determined.second(); + Pair<Boolean, Boolean> sortingCriteria = sortOnPriority(interceptedOrder); + boolean hasMultipleInterceptorsOrPriorities = sortingCriteria.first() || sortingCriteria.second();Also applies to: 727-727
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
CHANGES.txt
(1 hunks)testng-core/src/main/java/org/testng/TestRunner.java
(3 hunks)testng-core/src/test/java/test/thread/SharedThreadPoolTest.java
(2 hunks)testng-core/src/test/java/test/thread/issue3179/DummyMethodInterceptor.java
(1 hunks)testng-core/src/test/java/test/thread/issue3179/SampleSuiteAlteringListener.java
(1 hunks)testng-core/src/test/java/test/thread/issue3179/TestClassSample.java
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- testng-core/src/test/java/test/thread/issue3179/DummyMethodInterceptor.java
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: 21, liberica, macos, America/New_York, tr_TR, stress JIT
- GitHub Check: 17, temurin, ubuntu, America/New_York, tr_TR, stress JIT
- GitHub Check: 17, microsoft, same hashcode, ubuntu, Pacific/Chatham, de_DE
- GitHub Check: 11, temurin, windows, UTC, ru_RU
- GitHub Check: 11, temurin, macos, America/New_York, ru_RU, stress JIT
🔇 Additional comments (4)
testng-core/src/test/java/test/thread/issue3179/TestClassSample.java (1)
7-23
: LGTM! Well-structured test class.The test class effectively combines data-driven and regular tests to verify thread pool behavior. The parallel data provider is correctly configured.
testng-core/src/test/java/test/thread/SharedThreadPoolTest.java (1)
88-95
: LGTM! Well-implemented test case.The test method effectively verifies that priority-agnostic interceptors don't cause exceptions. Good use of the new listener and test class.
testng-core/src/main/java/org/testng/TestRunner.java (1)
666-670
: LGTM! Improved priority sorting logic.The method now clearly separates two concerns:
- Whether multiple interceptors are present
- Whether any method has a non-zero priority
This separation makes the code more maintainable and easier to understand.
CHANGES.txt (1)
2-3
: Clear and Concise Release Note UpdatesThe new release note entries for GITHUB-3179 and GITHUB-2765 succinctly document the fixes and correctly attribute contribution to Krishnan Mahadevan and Charlie Hayes respectively. In particular, the GITHUB-3179 entry addresses the ClassCastException related to the use of the
shouldUseGlobalThreadPool(true)
property, which ties directly into the PR’s objective of streamlining the shared thread pool functionality in TestNG. Please verify that these descriptions fully capture the behavioral improvements—especially ensuring that the framework now bypasses method interceptors when priority-driven tests are not in use. Overall, the update is clear and correctly formatted.
If a user is not using priority driven tests then TestNG should not consider any method interceptors that a user may be using. Closes testng-team#3179
a74ee64
to
c582ac0
Compare
If a user is not using priority driven tests then
TestNG should not consider any method interceptors that a user may be using.
Closes #3179
Fixes #3179 .
Did you remember to?
CHANGES.txt
./gradlew autostyleApply
We encourage pull requests that:
If your pull request involves fixing SonarQube issues then we would suggest that you please discuss this with the
TestNG-dev before you spend time working on it.
Note: For more information on contribution guidelines please make sure you refer our Contributing section for detailed set of steps.
Summary by CodeRabbit
Bug Fixes
ClassCastException
when using theshouldUseGlobalThreadPool(true)
property.Refactor
Tests