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 issue of : Ability to set the number of threads through Maven Command Line #2373 #2377

Closed
wants to merge 3 commits into from

Conversation

vipin1326
Copy link

@vipin1326 vipin1326 commented Aug 5, 2023

Description

Thanks for contributing this Pull Request. Make sure that you submit this Pull Request against the develop branch of this repository, add a brief description, and tag the relevant issue(s) and PR(s) below.

  • Relevant Issues : (compulsory)
  • Relevant PRs : (optional)
  • Type of change :
    • New feature
    • Bug fix for existing feature
    • Code quality improvement
    • Addition or Improvement of tests
    • Addition or Improvement of documentation

@@ -179,6 +179,9 @@ public List<FeatureCall> resolveAll() {
if (ko.paths != null) {
paths = ko.paths;
}
if (ko.threads > 0) {
Copy link
Member

Choose a reason for hiding this comment

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

I think it is 1 by default because of the code in Main.java - so this may ALWAYS be true and not honor what was set via the builde . maybe ko.threads != 1 is better logic, can you test this ?

Copy link
Author

Choose a reason for hiding this comment

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

Should be make it ko.threads > 1 or !=1 both seems fine to me, The reason why I have avoided ko.threads!=1 is what if value of threads set via build is by mistake negative or something like zero. Though this condition is also handled below, in code at https://github.com/karatelabs/karate/blob/v1.4.0/karate-core/src/main/java/com/intuit/karate/Runner.java#L271.

Copy link
Member

Choose a reason for hiding this comment

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

@vipin1326 we could have a case where builder set it to 2 in the code but we want to force it to 1 via the env and karate.options, does that make sense ?

Copy link
Author

Choose a reason for hiding this comment

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

@ptrthomas got your point, I have changed the check to ko.threads != 1. Also tested the same.

@ptrthomas
Copy link
Member

@vipin1326 really appreciate your inputs on this, and I apologize with going ahead with a fix: fb6616c

@ptrthomas ptrthomas closed this Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants