Skip to content

Commit

Permalink
test: fix tls-inception
Browse files Browse the repository at this point in the history
Make sure all the data is read before checking its validity.
Remove `gotHello` variable and just check that the ssl `end` event
is received.
Remove unused variables.

PR-URL: #4195
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
  • Loading branch information
santigimeno authored and indutny committed Dec 10, 2015
1 parent 37ed05b commit 86a3bd0
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions test/parallel/test-tls-inception.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ var fs = require('fs');
var path = require('path');
var net = require('net');

var options, a, b, portA, portB;
var gotHello = false;
var options, a, b;

var body = new Buffer(4000).fill('A');

Expand Down Expand Up @@ -43,10 +42,6 @@ b = tls.createServer(options, function(socket) {
socket.end(body);
});

process.on('exit', function() {
assert(gotHello);
});

a.listen(common.PORT, function() {
b.listen(common.PORT + 1, function() {
options = {
Expand All @@ -62,15 +57,14 @@ a.listen(common.PORT, function() {
});
ssl.setEncoding('utf8');
var buf = '';
ssl.once('data', function(data) {
ssl.on('data', function(data) {
buf += data;
gotHello = true;
});
ssl.on('end', function() {
ssl.on('end', common.mustCall(function() {
assert.equal(buf, body);
ssl.end();
a.close();
b.close();
});
}));
});
});

0 comments on commit 86a3bd0

Please sign in to comment.