Skip to content

Commit

Permalink
remove upper bound for number of worker threads (#3930)
Browse files Browse the repository at this point in the history
* remove upper bound for number of worker threads

* added test
  • Loading branch information
gravityvi committed Oct 24, 2023
1 parent fe5b281 commit c310689
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
7 changes: 1 addition & 6 deletions lib/runner/concurrency/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,7 @@ class Concurrency extends EventEmitter {
let workers = require('os').cpus().length;

if (isObject(test_workers) && isNumber(test_workers.workers)) {
if (workers < test_workers.workers) {
// eslint-disable-next-line no-console
Logger.warn(`Number of max workers is set to ${test_workers.workers} while the number of cpu cores is ${workers}. This can cause performance issues...\n`);
} else {
workers = test_workers.workers;
}
workers = test_workers.workers;
}

return workers;
Expand Down
19 changes: 18 additions & 1 deletion test/src/cli/testParallelExecution.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe('test Parallel Execution', function() {
const allOpts = [];

this.timeout(10000);
let workerCount;

beforeEach(function() {
mockery.enable({useCleanCache: true, warnOnUnregistered: false});
Expand Down Expand Up @@ -48,7 +49,7 @@ describe('test Parallel Execution', function() {

this.tasks = [];
this.index = 0;

workerCount = maxWorkerCount;
workerPoolArgv.push(args);
}

Expand Down Expand Up @@ -628,4 +629,20 @@ describe('test Parallel Execution', function() {
assert.equal(client2.transport.settings.webdriver.port, 9999);
});

it('test number of work threads for parallel execution', function() {

const CliRunner = common.require('runner/cli/cli.js');
const runner = new CliRunner({
reporter: 'junit',
config: path.join(__dirname, '../../extra/parallelism-count.json'),
env: 'default',
headless: true
});

runner.setup({});

return runner.runTests().then(_ => {
assert.strictEqual(workerCount, 4);
});
});
});

0 comments on commit c310689

Please sign in to comment.