Skip to content

Commit

Permalink
Blank lines removed from test files
Browse files Browse the repository at this point in the history
  • Loading branch information
Olegas committed Apr 13, 2015
1 parent 63a7bca commit 7ec2faa
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
14 changes: 0 additions & 14 deletions test/parallel/test-cluster-worker-wait-server-close-schednone.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,15 @@ var cluster = require('cluster');
var net = require('net');

if (cluster.isWorker) {

net.createServer(function(socket) {

// Wait for any data, then close connection
socket.on('data', socket.end.bind(socket));

}).listen(common.PORT, common.localhostIPv4);

} else if (cluster.isMaster) {

cluster.schedulingPolicy = cluster.SCHED_NONE;

var connectionDone;

var checks = {
disconnectedOnClientsEnd: false,
workerDied: false
Expand All @@ -40,20 +35,14 @@ if (cluster.isWorker) {
worker.once('listening', function() {
net.createConnection(common.PORT, common.localhostIPv4, function() {
var socket = this;

setTimeout(function() {

worker.disconnect();

setImmediate(function() {
socket.write('.');
connectionDone = true;
}, 1000);

}, 1000);

});

});

// Check worker events and properties
Expand All @@ -65,15 +54,12 @@ if (cluster.isWorker) {
worker.once('exit', function() {
checks.workerDied = !alive(worker.process.pid);
process.nextTick(function() {

process.exit(0);
});
});

process.once('exit', function() {

assert.ok(checks.disconnectedOnClientsEnd, 'The worker disconnected before all clients are ended');
assert.ok(checks.workerDied, 'The worker did not die');

});
}
15 changes: 0 additions & 15 deletions test/parallel/test-cluster-worker-wait-server-close-schedrr.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,15 @@ var cluster = require('cluster');
var net = require('net');

if (cluster.isWorker) {

net.createServer(function(socket) {

// Wait for any data, then close connection
socket.on('data', socket.end.bind(socket));

}).listen(common.PORT, common.localhostIPv4);

} else if (cluster.isMaster) {

cluster.schedulingPolicy = cluster.SCHED_RR;

var connectionDone;

var checks = {
disconnectedOnClientsEnd: false,
workerDied: false
Expand All @@ -38,26 +33,19 @@ if (cluster.isWorker) {

// Disconnect worker when it is ready
worker.once('listening', function() {

net.createConnection(common.PORT, common.localhostIPv4, function() {
var socket = this;

// If no timeout here, connection will not be accepted by worker
// cause' it will receive 'newconn' message after 'disconnect'
// and connection will not get accepted
setTimeout(function() {

worker.disconnect();

setImmediate(function() {
socket.write('.');
connectionDone = true;
}, 1000);

}, 1000);

});

});

// Check worker events and properties
Expand All @@ -69,15 +57,12 @@ if (cluster.isWorker) {
worker.once('exit', function() {
checks.workerDied = !alive(worker.process.pid);
process.nextTick(function() {

process.exit(0);
});
});

process.once('exit', function() {

assert.ok(checks.disconnectedOnClientsEnd, 'The worker disconnected before all clients are ended');
assert.ok(checks.workerDied, 'The worker did not die');

});
}

0 comments on commit 7ec2faa

Please sign in to comment.