Skip to content

Commit

Permalink
test: revise test-policy-integrity
Browse files Browse the repository at this point in the history
* eliminate unneeded Set deletion/cleanup
* use number of CPUs as limit for processes spawned rather than
  hard-coding the limit

PR-URL: #35101
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com>
  • Loading branch information
Trott authored and ruyadorno committed Sep 17, 2020
1 parent 93e4d54 commit 379c5ce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/pummel/test-policy-integrity.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const fs = require('fs');
const path = require('path');
const { pathToFileURL } = require('url');

const cpus = require('os').cpus().length;

function hash(algo, body) {
const values = [];
{
Expand Down Expand Up @@ -82,7 +84,7 @@ function queueSpawn(opts) {
}

function drainQueue() {
if (spawned > 50) {
if (spawned > cpus) {
return;
}
if (toSpawn.length) {
Expand Down Expand Up @@ -383,6 +385,5 @@ debug(`spawning ${tests.size} policy integrity permutations`);

for (const config of tests) {
const parsed = JSON.parse(config);
tests.delete(config);
queueSpawn(parsed);
}

0 comments on commit 379c5ce

Please sign in to comment.