Ameliorate a timing sensitivity issue by switching from setImmediate()
to setTimeout() with a 50 ms timeout.
This commit also adds EPIPE as an accepted error (besides ECONNABORT
and ECONNRESET) because that's a plausible outcome given the timing
sensitive nature of test.
PR-URL: https://github.com/iojs/io.js/pull/575
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
method: 'POST'
});
- var timer = setImmediate(write);
+ var timer = setTimeout(write, 50);
var writes = 0;
function write() {
req.end();
test();
} else {
- timer = setImmediate(write);
+ timer = setTimeout(write, 50);
req.write('hello');
}
}
case 'ECONNRESET':
// On windows this sometimes manifests as ECONNABORTED
case 'ECONNABORTED':
+ // This test is timing sensitive so an EPIPE is not out of the question.
+ // It should be infrequent, given the 50 ms timeout, but not impossible.
+ case 'EPIPE':
break;
default:
assert.strictEqual(er.code,