Skip to content

Commit a77dcfe

Browse files
TrottMyles Borins
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 a320045 commit a77dcfe

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
2-
varcommon=require('../common');
3-
varassert=require('assert');
4-
varhttp=require('http');
2+
constcommon=require('../common');
3+
constassert=require('assert');
4+
consthttp=require('http');
55

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

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

21-
varserver=http.createServer(function(req,res){
21+
constserver=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-
varreq=http.request(options,onresponse);
28+
constreq=http.request(options,onresponse);
2929
req.end();
3030

3131
functiononresponse(res){

0 commit comments

Comments
 (0)