-
Notifications
You must be signed in to change notification settings - Fork 542
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
[SUREFIRE-2075] Only set thread count if specified in configuration #528
[SUREFIRE-2075] Only set thread count if specified in configuration #528
Conversation
Please
|
8f84278
to
8461354
Compare
@sbabcoc |
@Tibor17 The [threadCount] value is ignored if not running in parallel mode; (In the implementation of In TestNG 5.1, tests are executed on the main thread when running in sequential mode. I'm not clear why a default thread count of 5 doesn't make sense for parallel configurations. Setting the default value to 1 is what doesn't make sense to me, because this will produce sequential execution behavior in configurations that specify parallel execution unless a thread count value is also specified. As it's currently implemented, the base Surefire TestNG configurator overrides the default thread count value established by the TestNG framework, altering the default parallel execution behavior. This default value imposed by TestNGMapConfigurator also contradicts the Surefire documentation. With my revisions in place, the documented default thread count is used, and all of the unit tests and integration tests complete successfully. |
@Tibor17 Also, I was under the impression that the reason for rejecting this change previously was that it was out of scope for resolution of SUREFIRE-2064, not that the rationale for this change was in question. |
f3fd04b
to
1f3013a
Compare
@slawekjaranowski I've added the JIRA to the commit message as requested, and all tests (unit + integration) run successfully. |
@Tibor17 With the revisions in this PR, the ASF TestNG implementation will exhibit the behavior you've described.
Without the revisions in this PR, tests always execute sequentially unless valid values are provided for both [parallel] and [threadCount]. Specifying [parallel] by itself is insufficient to activate parallel execution behavior. This contradicts the ASF documentation and alters the execution behavior exhibited natively by TestNG or in other test harnesses (e.g. - Gradle). The revisions in this PR resolve the issue of default [threadCount] value and always provide parallel execution behavior when [parallel] is specified. It also emits an actionable error message if an invalid value is specified for [threadCount], instead of the naked NumberFormatException that is currently produced. |
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.
LGTM and not sure how you could write a test for this?
@olamy Thanks for the review! The existing unit tests cover "happy path" behavior. I suppose we could add an exception case test or two. |
Is there a test which set only parallel options without settings threadCount? If not we can find test which set both parameters, and try with only one in copy of test. |
1f3013a
to
32e896a
Compare
@slawekjaranowski I just added a test that sets the [parallel] option without setting [threadcount]. The existing test that provided the basis for this new implementation sets both [parallel] and [threadcount]. |
Following this checklist to help us incorporate your
contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
[SUREFIRE-XXX] - Fixes bug in ApproximateQuantiles
,where you replace
SUREFIRE-XXX
with the appropriate JIRA issue. Best practiceis to use the JIRA issue title in the pull request title and in the first line of the
commit message.
mvn clean install
to make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
mvn -Prun-its clean install
).If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
In any other case, please file an Apache Individual Contributor License Agreement.