Browse Source

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
archived-io.js-v0.10
Timothy J Fontaine 11 years ago
parent
commit
41d8e10f0d
  1. 13
      test/simple/test-http-destroyed-socket-write2.js

13
test/simple/test-http-destroyed-socket-write2.js

@ -61,7 +61,18 @@ server.listen(common.PORT, function() {
req.on('error', function(er) { req.on('error', function(er) {
assert(!gotError); assert(!gotError);
gotError = true; 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); clearTimeout(timer);
console.log('ECONNRESET was raised after %d writes', writes); console.log('ECONNRESET was raised after %d writes', writes);
test(); test();

Loading…
Cancel
Save