Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions test/gc/test-http-client-connaborted.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ function serverHandler(req, res) {

const http = require('http');
const weak = require('weak');
const common = require('../common');
require('../common');
const assert = require('assert');
const PORT = common.PORT;
const todo = 500;
let done = 0;
let count = 0;
Expand All @@ -19,7 +18,7 @@ let countGC = 0;
console.log('We should do ' + todo + ' requests');

var server = http.createServer(serverHandler);
server.listen(PORT, getall);
server.listen(0, getall);

function getall() {
if (count >= todo)
Expand All @@ -34,7 +33,7 @@ function getall() {
var req = http.get({
hostname: 'localhost',
pathname: '/',
port: PORT
port: server.address().port
}, cb).on('error', cb);

count++;
Expand Down
7 changes: 3 additions & 4 deletions test/gc/test-http-client-onerror.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ function serverHandler(req, res) {

const http = require('http');
const weak = require('weak');
const common = require('../common');
require('../common');
const assert = require('assert');
const PORT = common.PORT;
const todo = 500;
let done = 0;
let count = 0;
Expand All @@ -21,7 +20,7 @@ let countGC = 0;
console.log('We should do ' + todo + ' requests');

var server = http.createServer(serverHandler);
server.listen(PORT, runTest);
server.listen(0, runTest);

function getall() {
if (count >= todo)
Expand All @@ -40,7 +39,7 @@ function getall() {
var req = http.get({
hostname: 'localhost',
pathname: '/',
port: PORT
port: server.address().port
}, cb).on('error', onerror);

count++;
Expand Down
7 changes: 3 additions & 4 deletions test/gc/test-http-client-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ function serverHandler(req, res) {

const http = require('http');
const weak = require('weak');
const common = require('../common');
require('../common');
const assert = require('assert');
const PORT = common.PORT;
const todo = 550;
let done = 0;
let count = 0;
Expand All @@ -23,7 +22,7 @@ let countGC = 0;
console.log('We should do ' + todo + ' requests');

var server = http.createServer(serverHandler);
server.listen(PORT, getall);
server.listen(0, getall);

function getall() {
if (count >= todo)
Expand All @@ -39,7 +38,7 @@ function getall() {
var req = http.get({
hostname: 'localhost',
pathname: '/',
port: PORT
port: server.address().port
}, cb);
req.on('error', cb);
req.setTimeout(10, function() {
Expand Down
7 changes: 3 additions & 4 deletions test/gc/test-http-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ function serverHandler(req, res) {

const http = require('http');
const weak = require('weak');
const common = require('../common');
require('../common');
const assert = require('assert');
const PORT = common.PORT;
const todo = 500;
let done = 0;
let count = 0;
Expand All @@ -19,7 +18,7 @@ let countGC = 0;
console.log('We should do ' + todo + ' requests');

var server = http.createServer(serverHandler);
server.listen(PORT, getall);
server.listen(0, getall);


function getall() {
Expand All @@ -37,7 +36,7 @@ function getall() {
var req = http.get({
hostname: 'localhost',
pathname: '/',
port: PORT
port: server.address().port
}, cb);

count++;
Expand Down
7 changes: 3 additions & 4 deletions test/gc/test-net-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ function serverHandler(sock) {

const net = require('net');
const weak = require('weak');
const common = require('../common');
require('../common');
const assert = require('assert');
const PORT = common.PORT;
const todo = 500;
let done = 0;
let count = 0;
Expand All @@ -30,14 +29,14 @@ let countGC = 0;
console.log('We should do ' + todo + ' requests');

var server = net.createServer(serverHandler);
server.listen(PORT, getall);
server.listen(0, getall);

function getall() {
if (count >= todo)
return;

(function() {
var req = net.connect(PORT, '127.0.0.1');
var req = net.connect(server.address().port, server.address().address);
req.resume();
req.setTimeout(10, function() {
//console.log('timeout (expected)')
Expand Down