From 41d8e10f0d7b44c5c978f288f10091a877106f71 Mon Sep 17 00:00:00 2001 From: Timothy J Fontaine Date: Tue, 6 May 2014 10:45:20 -0700 Subject: [PATCH] test: http-destroyed-socket-write win32 may ABORT On windows you can see ECONNABORTED instead of ECONNRESET in various scenarios, and they are both applicable we're testing that Node is not swallowing these errors which it was known to do prior to 0.10 --- test/simple/test-http-destroyed-socket-write2.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/simple/test-http-destroyed-socket-write2.js b/test/simple/test-http-destroyed-socket-write2.js index f72086dc649..3347f3ccc9a 100644 --- a/test/simple/test-http-destroyed-socket-write2.js +++ b/test/simple/test-http-destroyed-socket-write2.js @@ -61,7 +61,18 @@ server.listen(common.PORT, function() { req.on('error', function(er) { assert(!gotError); gotError = true; - assert(er.code === 'ECONNRESET', 'Expected ECONNRESET, got ' + er.code + ' ' + er.syscall); + switch (er.code) { + // This is the expected case + case 'ECONNRESET': + // On windows this sometimes manifests as ECONNABORTED + case 'ECONNABORTED': + break; + default: + assert.strictEqual(er.code, + 'ECONNRESET', + 'Writing to a torn down client should RESET or ABORT'); + break; + } clearTimeout(timer); console.log('ECONNRESET was raised after %d writes', writes); test();