From 4c3f93e2c7c58ee33d43e9640494461c18a2fcfb Mon Sep 17 00:00:00 2001
From: Michael Dawson <michael_dawson@ca.ibm.com>
Date: Thu, 4 Apr 2019 13:03:48 -0400
Subject: [PATCH 1/2] test: fix test-worker-memory.js for large cpu #s

This test consistently failed on a system with a
large number of cores (~120). Cap the number of
concurrent workers so we'll stay consistently within
the "slack" allowed with respect to rss.
---
 test/parallel/test-worker-memory.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/parallel/test-worker-memory.js b/test/parallel/test-worker-memory.js
index 56b06858ddd93f..39096be2922bee 100644
--- a/test/parallel/test-worker-memory.js
+++ b/test/parallel/test-worker-memory.js
@@ -4,7 +4,13 @@ const assert = require('assert');
 const util = require('util');
 const { Worker } = require('worker_threads');
 
-const numWorkers = +process.env.JOBS || require('os').cpus().length;
+let numWorkers = +process.env.JOBS || require('os').cpus().length;
+if (numWorkers > 20) {
+  // Cap the number of workers at 20 (as an even divsor of 60 used as
+  // the total number of workers started) otherwise the test fails on
+  // machines with high core counts.
+  numWorkers = 20;
+}
 
 // Verify that a Worker's memory isn't kept in memory after the thread finishes.
 

From 9902b1c6cae9e3a511bf802eb08dcd25c9a74bda Mon Sep 17 00:00:00 2001
From: Richard Lau <riclau@uk.ibm.com>
Date: Fri, 5 Apr 2019 10:21:57 -0400
Subject: [PATCH 2/2] Squash: address comment

Co-Authored-By: mhdawson <michael_dawson@ca.ibm.com>
---
 test/parallel/test-worker-memory.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/parallel/test-worker-memory.js b/test/parallel/test-worker-memory.js
index 39096be2922bee..db204244a533d7 100644
--- a/test/parallel/test-worker-memory.js
+++ b/test/parallel/test-worker-memory.js
@@ -6,7 +6,7 @@ const { Worker } = require('worker_threads');
 
 let numWorkers = +process.env.JOBS || require('os').cpus().length;
 if (numWorkers > 20) {
-  // Cap the number of workers at 20 (as an even divsor of 60 used as
+  // Cap the number of workers at 20 (as an even divisor of 60 used as
   // the total number of workers started) otherwise the test fails on
   // machines with high core counts.
   numWorkers = 20;