diff options
author | Luigi Pinca <luigipinca@gmail.com> | 2019-11-01 07:08:00 +0100 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-11-07 19:23:37 -0800 |
commit | 96db5a271c859eabbf81565e4ce82a93fd037fb9 (patch) | |
tree | 586da513ebecbb3f7ccf887d27fe24736a88804c /test | |
parent | 6072e01c938e22498cd46c3d8a2c21a16a632456 (diff) | |
download | android-node-v8-96db5a271c859eabbf81565e4ce82a93fd037fb9.tar.gz android-node-v8-96db5a271c859eabbf81565e4ce82a93fd037fb9.tar.bz2 android-node-v8-96db5a271c859eabbf81565e4ce82a93fd037fb9.zip |
test: deflake test-tls-close-notify.js
This test occasionally fails on macOS with the following error
```
events.js:187
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TLSWrap.onStreamRead (internal/stream_base_commons.js:201:27)
Emitted 'error' event on TLSSocket instance at:
at emitErrorNT (internal/streams/destroy.js:84:8)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: -54,
code: 'ECONNRESET',
syscall: 'read'
}
```
Fix it by making the client send the close_notify alert instead of the
server.
PR-URL: https://github.com/nodejs/node/pull/30202
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-tls-close-notify.js | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/test/parallel/test-tls-close-notify.js b/test/parallel/test-tls-close-notify.js index 808727b127..d7153b87ba 100644 --- a/test/parallel/test-tls-close-notify.js +++ b/test/parallel/test-tls-close-notify.js @@ -35,19 +35,18 @@ const server = tls.createServer({ key: fixtures.readKey('agent1-key.pem'), cert: fixtures.readKey('agent1-cert.pem') }, function(c) { - // Send close-notify without shutting down TCP socket - const req = new ShutdownWrap(); - req.oncomplete = common.mustCall(() => {}); - req.handle = c._handle; - c._handle.shutdown(req); + // Ensure that we receive 'end' event anyway. + c.on('end', common.mustCall(function() { + server.close(); + })); }).listen(0, common.mustCall(function() { const c = tls.connect(this.address().port, { rejectUnauthorized: false }, common.mustCall(function() { - // Ensure that we receive 'end' event anyway - c.on('end', common.mustCall(function() { - c.destroy(); - server.close(); - })); + // Send close-notify without shutting down TCP socket. + const req = new ShutdownWrap(); + req.oncomplete = common.mustCall(() => {}); + req.handle = c._handle; + c._handle.shutdown(req); })); })); |