Has anyone found a practical way to ‘weight’ test ...
# community-support
c
Has anyone found a practical way to ‘weight’ test forks when they consume worker leases? I know that it’s possible to cap the max concurrency of a test task, and possible to use build services to control concurrency of a set of test tasks. What I’m trying to explore is having a given tests forks occupy as an example two worker leases rather than one? I’m trying to find a way to maximally occupy a machine without overburdening or leaving periods of low utilization which slow the build down. Thoughts?
v
Are you after the
maxParallelForks
option of the
Test
task?
Btw. I usually recommend not to use that, but instead use parallel execution within the test framework if it supports it like for example JUnit Jupiter or Spock do. They can much better utilize and manage parallel execution as long as the tests are written compatibly (not influence each other, or declare proper locks).
The
maxParallelForks
iirc just distributes the test classes to the forks, but if one test class has 1 test and one has 1000 tests, the utilization is not really great.
c
I’m not currently using
maxParallelForks
, but yes I’m aware of those issues, and the frequent requests for work stealing approaches there. I’m more thinking about optimizing across large numbers of projects… I’ve got a ~40 sub-project build where some tests tasks are heavyweight system tests and others are very lightweight pure unit testing tasks. Gradle treats all these the same though as far as worker leases are concerned. So if I have 10 worker leases I might tolerate 10 unit testing tasks, but 10 system test tasks might be a little much. I’d like to find a way to account for those different weightings when assigning worker leases.
v
Oh, I see
Sorry totally misread obviously