Skip to content

Commit 37a3622

Browse files
cjihrigMylesBorins
authored andcommitted
test: update test-cluster-shared-handle-bind-error
- Remove assignment of this to variable. - Add common.mustCall() as needed. - Move from var to const. PR-URL: #10547 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent f5e54f5 commit 37a3622

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

test/parallel/test-cluster-shared-handle-bind-error.js

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert');
4-
var cluster = require('cluster');
5-
var net = require('net');
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const cluster = require('cluster');
5+
const net = require('net');
66

77
if (cluster.isMaster) {
88
// Master opens and binds the socket and shares it with the worker.
99
cluster.schedulingPolicy = cluster.SCHED_NONE;
1010
// Hog the TCP port so that when the worker tries to bind, it'll fail.
11-
net.createServer(common.fail).listen(common.PORT, function() {
12-
var server = this;
13-
var worker = cluster.fork();
14-
worker.on('exit', common.mustCall(function(exitCode) {
11+
const server = net.createServer(common.fail);
12+
13+
server.listen(common.PORT, common.mustCall(() => {
14+
const worker = cluster.fork();
15+
worker.on('exit', common.mustCall((exitCode) => {
1516
assert.strictEqual(exitCode, 0);
1617
server.close();
1718
}));
18-
});
19+
}));
1920
} else {
20-
var s = net.createServer(common.fail);
21+
const s = net.createServer(common.fail);
2122
s.listen(common.PORT, common.fail.bind(null, 'listen should have failed'));
22-
s.on('error', common.mustCall(function(err) {
23+
s.on('error', common.mustCall((err) => {
2324
assert.strictEqual(err.code, 'EADDRINUSE');
2425
process.disconnect();
2526
}));

0 commit comments

Comments
 (0)