You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could you please apply this patch that improve testing robustness:
Subject: Use high port random for testing
Author: Bastien Roucariès <rouca@debian.org>
Avoid port collision by using high port
Forwarded:
Index: node-timed-out/test.js
===================================================================--- node-timed-out.orig/test.js+++ node-timed-out/test.js@@ -6,6 +6,7 @@ var assert = require('assert');
var http = require('http');
var net = require('net');
var timeout = require('./');
+var port = Math.floor(Math.random() * (60000 - 30000) + 30000)
/*
it('should do HTTP request with a lot of time', function (done) {
@@ -40,7 +41,7 @@ describe('when connection is established
before(function (done) {
server = http.createServer();
- server.listen(8081, done);+ server.listen(port, done);
});
after(function (done) {
@@ -50,11 +51,11 @@ describe('when connection is established
it('should emit ESOCKETTIMEDOUT (no data)', function (done) {
server.once('request', function () {});
- var req = http.get('http://0.0.0.0:8081');+ var req = http.get('http://0.0.0.0:'+port);
req.on('error', function (err) {
if (err.code === 'ESOCKETTIMEDOUT') {
- assert.equal(err.message, 'Socket timed out on request to 0.0.0.0:8081');+ assert.equal(err.message, 'Socket timed out on request to 0.0.0.0:'+port);
done();
}
});
@@ -72,7 +73,7 @@ describe('when connection is established
var called = false;
var body = '';
- var req = http.get('http://0.0.0.0:8081');+ var req = http.get('http://0.0.0.0:'+port);
req.on('response', function (res) {
called = true;
@@ -88,7 +89,7 @@ describe('when connection is established
if (err.code === 'ESOCKETTIMEDOUT') {
assert.ok(called);
assert.equal(body, 'chunk');
- assert.equal(err.message, 'Socket timed out on request to 0.0.0.0:8081');+ assert.equal(err.message, 'Socket timed out on request to 0.0.0.0:'+port);
done();
}
});
@@ -104,7 +105,7 @@ describe('when connection is established
}, 100);
});
- var req = http.get('http://0.0.0.0:8081');+ var req = http.get('http://0.0.0.0:'+port);
req.on('error', done);
req.on('finish', done);
@@ -120,11 +121,11 @@ describe('when connection is established
}, 200);
});
- var req = http.get('http://0.0.0.0:8081');+ var req = http.get('http://0.0.0.0:'+port);
req.on('error', function (err) {
if (err.code === 'ESOCKETTIMEDOUT') {
- assert.equal(err.message, 'Socket timed out on request to 0.0.0.0:8081');+ assert.equal(err.message, 'Socket timed out on request to 0.0.0.0:'+port);
done();
}
});
@@ -147,7 +148,7 @@ describe('when connection is established
var reqOpts = {
hostname: '0.0.0.0',
- port: 8081,+ port: port,
agent: keepAliveAgent
};
@@ -176,13 +177,13 @@ describe('when connection is established
it('should set socket timeout if socket is already connected', function (done) {
server.once('request', function () {});
- var socket = net.connect(8081, '0.0.0.0', function () {+ var socket = net.connect(port, '0.0.0.0', function () {
var req = http.get({
createConnection: function () {
return socket;
},
hostname: '0.0.0.0',
- port: 8081+ port: port
});
req.on('error', function (err) {
@@ -210,7 +211,7 @@ describe('when connection is established
var options = {
hostname: '0.0.0.0',
agent: agent,
- port: 8081+ port: port
};
var req = http.get(options, function (res) {
The text was updated successfully, but these errors were encountered:
Could you please apply this patch that improve testing robustness:
The text was updated successfully, but these errors were encountered: