From fcb5d959437b1f28e5e7bb9b206af9e96e126154 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 13 Aug 2020 19:32:55 -0700 Subject: [PATCH] test: allow ENFILE in test-worker-init-failure Refs: /~https://github.com/nodejs/node/pull/34727#issuecomment-672862034 PR-URL: /~https://github.com/nodejs/node/pull/34769 Reviewed-By: Gireesh Punathil Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen Reviewed-By: Denys Otrishko Reviewed-By: Ben Noordhuis Reviewed-By: Ricky Zhou <0x19951125@gmail.com> --- test/parallel/test-worker-init-failure.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-worker-init-failure.js b/test/parallel/test-worker-init-failure.js index aa5513b2f93057..e87238237aad4e 100644 --- a/test/parallel/test-worker-init-failure.js +++ b/test/parallel/test-worker-init-failure.js @@ -30,12 +30,14 @@ if (process.argv[2] === 'child') { }); // We want to test that if there is an error in a constrained running - // environment, it will be one of `EMFILE` or `ERR_WORKER_INIT_FAILED`. + // environment, it will be one of `ENFILE`, `EMFILE`, or + // `ERR_WORKER_INIT_FAILED`. + const allowableCodes = ['ERR_WORKER_INIT_FAILED', 'EMFILE', 'ENFILE']; + // `common.mustCall*` cannot be used here as in some environments // (i.e. single cpu) `ulimit` may not lead to such an error. - worker.on('error', (e) => { - assert.ok(e.code === 'ERR_WORKER_INIT_FAILED' || e.code === 'EMFILE'); + assert.ok(allowableCodes.includes(e.code), `${e.code} not expected`); }); }