mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
test: move inspector test back to parallel, unmark flaky
After https://github.com/nodejs/node/pull/21182, the test is no longer flaky. Since it doesn’t use a static port, moving it to parallel seems justified. PR-URL: https://github.com/nodejs/node/pull/21806 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
1 parent
4ed4bf3bdd
commit
eef975ebae
2 files changed
-1
No files matched your search
@@ -16,7 +16,6 @@ test-inspector-bindings : PASS, FLAKY
|
||||
test-inspector-debug-end : PASS, FLAKY
|
||||
|
||||
[$system==linux]
|
||||
test-inspector-port-zero-cluster : PASS, FLAKY
|
||||
|
||||
[$system==macos]
|
||||
|
||||
|
||||
@@ -1,49 +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.splice(0, 0, process.debugPort);
|
||||
// 4 = [master, worker1, worker2, worker3].length()
|
||||
assert.strictEqual(ports.length, 4);
|
||||
assert(ports.every((port) => port > 0));
|
||||
assert(ports.every((port) => port < 65536));
|
||||
assert.strictEqual(ports[0] === 65535 ? 1024 : ports[0] + 1, ports[1]);
|
||||
assert.strictEqual(ports[1] === 65535 ? 1024 : ports[1] + 1, ports[2]);
|
||||
assert.strictEqual(ports[2] === 65535 ? 1024 : ports[2] + 1, ports[3]);
|
||||
}))
|
||||
.catch(
|
||||
(err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
} else {
|
||||
process.exit(0);
|
||||
}
|
||||
Reference in new issue
Block a user