summaryrefslogtreecommitdiff
path: root/test/parallel/test-inspector-port-zero-cluster.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-10-17 21:50:25 -0700
committerRich Trott <rtrott@gmail.com>2017-10-17 23:10:20 -0700
commit9be3d99b2b94d8a08b5a36efb06f3a6fd196805a (patch)
tree77a6cd98b9fc4e72134ddde0fbfd2606af39f91c /test/parallel/test-inspector-port-zero-cluster.js
parent978629ca1240b9f2038390c7e960f3d226daa4e8 (diff)
downloadandroid-node-v8-9be3d99b2b94d8a08b5a36efb06f3a6fd196805a.tar.gz
android-node-v8-9be3d99b2b94d8a08b5a36efb06f3a6fd196805a.tar.bz2
android-node-v8-9be3d99b2b94d8a08b5a36efb06f3a6fd196805a.zip
test: fix inspector tests
The inspector tests should not be in the parallel directory as they likely all (or certainly almost all) use static ports, so port collisions will happen. This moves them all to sequential. We can move them back on a case-by-case basis. They were run sequentially when they were in the inspector directory which they were only moved from very recently. PR-URL: https://github.com/nodejs/node/pull/16281 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Bryan English <bryan@bryanenglish.com>
Diffstat (limited to 'test/parallel/test-inspector-port-zero-cluster.js')
-rw-r--r--test/parallel/test-inspector-port-zero-cluster.js51
1 files changed, 0 insertions, 51 deletions
diff --git a/test/parallel/test-inspector-port-zero-cluster.js b/test/parallel/test-inspector-port-zero-cluster.js
deleted file mode 100644
index f64e05f314..0000000000
--- a/test/parallel/test-inspector-port-zero-cluster.js
+++ /dev/null
@@ -1,51 +0,0 @@
-// Flags: --inspect=0
-'use strict';
-const common = require('../common');
-
-common.skipIfInspectorDisabled();
-
-// Assert that even when started with `--inspect=0` workers are assigned
-// consecutive (i.e. deterministically predictable) debug ports
-
-const assert = require('assert');
-const cluster = require('cluster');
-
-function serialFork() {
- return new Promise((res) => {
- const worker = cluster.fork();
- worker.on('exit', common.mustCall((code, signal) => {
- // code 0 is normal
- // code 12 can happen if inspector could not bind because of a port clash
- if (code !== 0 && code !== 12)
- assert.fail(`code: ${code}, signal: ${signal}`);
- const port = worker.process.spawnargs
- .map((a) => (/=(?:.*:)?(\d{2,5})$/.exec(a) || [])[1])
- .filter((p) => p)
- .pop();
- res(Number(port));
- }));
- });
-}
-
-if (cluster.isMaster) {
- Promise.all([serialFork(), serialFork(), serialFork()])
- .then(common.mustCall((ports) => {
- ports.push(process.debugPort);
- ports.sort();
- // 4 = [master, worker1, worker2, worker3].length()
- assert.strictEqual(ports.length, 4);
- assert(ports.every((port) => port > 0));
- assert(ports.every((port) => port < 65536));
- // Ports should be consecutive.
- assert.strictEqual(ports[0] + 1, ports[1]);
- assert.strictEqual(ports[1] + 1, ports[2]);
- assert.strictEqual(ports[2] + 1, ports[3]);
- }))
- .catch(
- (err) => {
- console.error(err);
- process.exit(1);
- });
-} else {
- process.exit(0);
-}