Skip to content

Commit 00b839a

Browse files
Trottrvagg
authored andcommitted
test: use platform-based timeout for reliability
test-http-client-timeout-with-data fails on Raspberry Pi in CI from time to time. Use a platform-based timeout to improve reliability. PR-URL: #4015 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Roman Reiss <me@silverwind.io>
1 parent aaab108 commit 00b839a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/parallel/test-http-client-timeout-with-data.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert');
4-
var http = require('http');
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const http = require('http');
55

66
var ntimeouts = 0;
77
var nchunks = 0;
@@ -11,21 +11,21 @@ process.on('exit', function() {
1111
assert.equal(nchunks, 2);
1212
});
1313

14-
var options = {
14+
const options = {
1515
method: 'GET',
1616
port: common.PORT,
1717
host: '127.0.0.1',
1818
path: '/'
1919
};
2020

21-
var server = http.createServer(function(req, res) {
21+
const server = http.createServer(function(req, res) {
2222
res.writeHead(200, {'Content-Length':'2'});
2323
res.write('*');
24-
setTimeout(function() { res.end('*'); }, 100);
24+
setTimeout(function() { res.end('*'); }, common.platformTimeout(100));
2525
});
2626

2727
server.listen(options.port, options.host, function() {
28-
var req = http.request(options, onresponse);
28+
const req = http.request(options, onresponse);
2929
req.end();
3030

3131
function onresponse(res) {

0 commit comments

Comments
 (0)