Skip to content

Commit f6498d7

Browse files
lpincatargos
authored andcommitted
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: #30202 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent cf89100 commit f6498d7

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

test/parallel/test-tls-close-notify.js

+9-10
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,18 @@ const server = tls.createServer({
3535
key: fixtures.readKey('agent1-key.pem'),
3636
cert: fixtures.readKey('agent1-cert.pem')
3737
}, function(c) {
38-
// Send close-notify without shutting down TCP socket
39-
const req = new ShutdownWrap();
40-
req.oncomplete = common.mustCall(() => {});
41-
req.handle = c._handle;
42-
c._handle.shutdown(req);
38+
// Ensure that we receive 'end' event anyway.
39+
c.on('end', common.mustCall(function() {
40+
server.close();
41+
}));
4342
}).listen(0, common.mustCall(function() {
4443
const c = tls.connect(this.address().port, {
4544
rejectUnauthorized: false
4645
}, common.mustCall(function() {
47-
// Ensure that we receive 'end' event anyway
48-
c.on('end', common.mustCall(function() {
49-
c.destroy();
50-
server.close();
51-
}));
46+
// Send close-notify without shutting down TCP socket.
47+
const req = new ShutdownWrap();
48+
req.oncomplete = common.mustCall(() => {});
49+
req.handle = c._handle;
50+
c._handle.shutdown(req);
5251
}));
5352
}));

0 commit comments

Comments
 (0)