0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-cluster-disconnect-leak.js
Tarun Batra 415098f499 test: remove common.PORT from test-cluster*.js
PR-URL: https://github.com/nodejs/node/pull/12441
Ref: https://github.com/nodejs/node/issues/12376
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-18 09:43:46 -07:00

28 lines
655 B
JavaScript

'use strict';
// Test fails in Node v5.4.0 and passes in v5.4.1 and newer.
const common = require('../common');
const net = require('net');
const cluster = require('cluster');
cluster.schedulingPolicy = cluster.SCHED_NONE;
if (cluster.isMaster) {
const worker = cluster.fork();
// This is the important part of the test: Confirm that `disconnect` fires.
worker.on('disconnect', common.mustCall());
// These are just some extra stuff we're checking for good measure...
worker.on('exit', common.mustCall());
cluster.on('exit', common.mustCall());
cluster.disconnect();
return;
}
const server = net.createServer();
server.listen(0);