Skip to content

Commit 86a3bd0

Browse files
santigimenoindutny
authored andcommitted
test: fix tls-inception
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 <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
1 parent 37ed05b commit 86a3bd0

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

test/parallel/test-tls-inception.js

+4-10
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ var fs = require('fs');
1212
var path = require('path');
1313
var net = require('net');
1414

15-
var options, a, b, portA, portB;
16-
var gotHello = false;
15+
var options, a, b;
1716

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

@@ -43,10 +42,6 @@ b = tls.createServer(options, function(socket) {
4342
socket.end(body);
4443
});
4544

46-
process.on('exit', function() {
47-
assert(gotHello);
48-
});
49-
5045
a.listen(common.PORT, function() {
5146
b.listen(common.PORT + 1, function() {
5247
options = {
@@ -62,15 +57,14 @@ a.listen(common.PORT, function() {
6257
});
6358
ssl.setEncoding('utf8');
6459
var buf = '';
65-
ssl.once('data', function(data) {
60+
ssl.on('data', function(data) {
6661
buf += data;
67-
gotHello = true;
6862
});
69-
ssl.on('end', function() {
63+
ssl.on('end', common.mustCall(function() {
7064
assert.equal(buf, body);
7165
ssl.end();
7266
a.close();
7367
b.close();
74-
});
68+
}));
7569
});
7670
});

0 commit comments

Comments
 (0)