Remove unneeded timers from some tests and move others from parallel testing to sequential testing. This is to resolve test failures on freebsd10-64 on CI. The failures are all due to timers firing later than expected. Timers firing later than they are set for can happen on resource-constrained hosts and is not a bug. In general, it may be wise to put tests that depend on timing into sequential testing rather than parallel testing, as the timing can be affected by other simultaneously-running test processes. Fixes: https://github.com/nodejs/node/issues/8041 Fixes: https://github.com/nodejs/node/issues/9227 PR-URL: https://github.com/nodejs/node/pull/9317 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Julien Gilli <jgilli@nodejs.org> Reviewed-By: Johan Bergstrom <bugs@bergstroem.nu> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
36 lines
767 B
JavaScript
36 lines
767 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const http = require('http');
|
|
|
|
const server = http.createServer((req, res) => {
|
|
server.close();
|
|
|
|
res.writeHead(200);
|
|
res.flushHeaders();
|
|
|
|
req.setTimeout(common.platformTimeout(200), () => {
|
|
common.fail('Request timeout should not fire');
|
|
});
|
|
req.resume();
|
|
req.once('end', common.mustCall(() => {
|
|
res.end();
|
|
}));
|
|
});
|
|
|
|
server.listen(0, common.mustCall(() => {
|
|
const req = http.request({
|
|
port: server.address().port,
|
|
method: 'POST'
|
|
}, (res) => {
|
|
const interval = setInterval(() => {
|
|
req.write('a');
|
|
}, common.platformTimeout(25));
|
|
setTimeout(() => {
|
|
clearInterval(interval);
|
|
req.end();
|
|
}, common.platformTimeout(200));
|
|
});
|
|
req.write('.');
|
|
}));
|