2015-12-29 10:21:55 +01:00
|
|
|
'use strict';
|
2016-01-17 19:50:09 -08:00
|
|
|
|
|
|
|
// Test fails in Node v5.4.0 and passes in v5.4.1 and newer.
|
2015-12-29 10:21:55 +01:00
|
|
|
|
|
|
|
const common = require('../common');
|
|
|
|
const net = require('net');
|
|
|
|
const cluster = require('cluster');
|
|
|
|
|
|
|
|
cluster.schedulingPolicy = cluster.SCHED_NONE;
|
|
|
|
|
2020-12-10 16:53:44 -05:00
|
|
|
if (cluster.isPrimary) {
|
2016-01-17 19:50:09 -08:00
|
|
|
const worker = cluster.fork();
|
|
|
|
|
|
|
|
// This is the important part of the test: Confirm that `disconnect` fires.
|
2017-03-24 09:46:44 -07:00
|
|
|
worker.on('disconnect', common.mustCall());
|
2016-01-17 19:50:09 -08:00
|
|
|
|
|
|
|
// These are just some extra stuff we're checking for good measure...
|
2017-03-24 09:46:44 -07:00
|
|
|
worker.on('exit', common.mustCall());
|
|
|
|
cluster.on('exit', common.mustCall());
|
2015-12-29 10:21:55 +01:00
|
|
|
|
2016-01-17 19:50:09 -08:00
|
|
|
cluster.disconnect();
|
2015-12-29 10:21:55 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-01-17 19:50:09 -08:00
|
|
|
const server = net.createServer();
|
2015-12-29 10:21:55 +01:00
|
|
|
|
2017-04-16 20:07:19 +05:30
|
|
|
server.listen(0);
|