mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
test: remove common.PORT from assorted pummel tests
Use port "0" for an OS-provided open port instead of common.PORT. PR-URL: https://github.com/nodejs/node/pull/31897 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
This commit is contained in:
parent
793cfe54cd
commit
97c8abe2c0
8 changed files with 20 additions and 20 deletions
|
@ -20,7 +20,7 @@
|
|||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
|
||||
|
@ -40,9 +40,9 @@ server.once('connection', function(c) {
|
|||
connection = c;
|
||||
});
|
||||
|
||||
server.listen(common.PORT, function connect() {
|
||||
server.listen(0, function connect() {
|
||||
const request = http.get({
|
||||
port: common.PORT,
|
||||
port: server.address().port,
|
||||
path: '/',
|
||||
headers: {
|
||||
'Connection': 'Keep-alive'
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
// This tests setTimeout() by having multiple clients connecting and sending
|
||||
// data in random intervals. Clients are also randomly disconnecting until there
|
||||
// are no more clients left. If no false timeout occurs, this test has passed.
|
||||
const common = require('../common');
|
||||
require('../common');
|
||||
const http = require('http');
|
||||
const server = http.createServer();
|
||||
let connections = 0;
|
||||
|
@ -44,13 +44,13 @@ server.on('request', function(req, res) {
|
|||
req.resume();
|
||||
});
|
||||
|
||||
server.listen(common.PORT, '127.0.0.1', function() {
|
||||
server.listen(0, '127.0.0.1', function() {
|
||||
for (let i = 0; i < 10; i++) {
|
||||
connections++;
|
||||
|
||||
setTimeout(function() {
|
||||
const request = http.request({
|
||||
port: common.PORT,
|
||||
port: server.address().port,
|
||||
method: 'POST',
|
||||
path: '/'
|
||||
});
|
||||
|
|
|
@ -43,9 +43,9 @@ const server = https.createServer(options, common.mustCall(function(req, res) {
|
|||
res.end(body);
|
||||
}));
|
||||
|
||||
server.listen(common.PORT, common.mustCall(function() {
|
||||
server.listen(0, common.mustCall(function() {
|
||||
https.get({
|
||||
port: common.PORT,
|
||||
port: server.address().port,
|
||||
rejectUnauthorized: false
|
||||
}, common.mustCall(function(res) {
|
||||
console.log('response!');
|
||||
|
|
|
@ -43,10 +43,10 @@ const server = https.createServer(options, function(req, res) {
|
|||
res.end();
|
||||
});
|
||||
|
||||
server.listen(common.PORT, function() {
|
||||
server.listen(0, function() {
|
||||
const req = https.request({
|
||||
method: 'POST',
|
||||
port: common.PORT,
|
||||
port: server.address().port,
|
||||
rejectUnauthorized: false
|
||||
}, function(res) {
|
||||
res.read(0);
|
||||
|
|
|
@ -24,7 +24,7 @@ const common = require('../common');
|
|||
const assert = require('assert');
|
||||
const net = require('net');
|
||||
|
||||
function pingPongTest(port, host, on_complete) {
|
||||
function pingPongTest(host, on_complete) {
|
||||
const N = 100;
|
||||
const DELAY = 1;
|
||||
let count = 0;
|
||||
|
@ -63,8 +63,8 @@ function pingPongTest(port, host, on_complete) {
|
|||
});
|
||||
});
|
||||
|
||||
server.listen(port, host, common.mustCall(function() {
|
||||
const client = net.createConnection(port, host);
|
||||
server.listen(0, host, common.mustCall(function() {
|
||||
const client = net.createConnection(server.address().port, host);
|
||||
|
||||
client.setEncoding('utf8');
|
||||
|
||||
|
@ -104,4 +104,4 @@ function pingPongTest(port, host, on_complete) {
|
|||
}));
|
||||
}
|
||||
|
||||
pingPongTest(common.PORT);
|
||||
pingPongTest();
|
||||
|
|
|
@ -48,7 +48,7 @@ const server = net.createServer(function(socket) {
|
|||
});
|
||||
|
||||
|
||||
server.listen(common.PORT, function() {
|
||||
const s = net.connect(common.PORT);
|
||||
server.listen(0, function() {
|
||||
const s = net.connect(server.address().port);
|
||||
s.pipe(process.stdout);
|
||||
});
|
||||
|
|
|
@ -52,7 +52,7 @@ function makeRequest() {
|
|||
// more easily. Also, this is handy when using this test to
|
||||
// view V8 opt/deopt behavior.
|
||||
const args = process.execArgv.concat([ childScript,
|
||||
common.PORT,
|
||||
server.address().port,
|
||||
bytesExpected ]);
|
||||
|
||||
const child = spawn(process.execPath, args);
|
||||
|
@ -101,7 +101,7 @@ const server = https.Server(serverOptions, function(req, res) {
|
|||
});
|
||||
});
|
||||
|
||||
server.listen(common.PORT, function() {
|
||||
server.listen(0, function() {
|
||||
console.log(`expecting ${bytesExpected} bytes`);
|
||||
makeRequest();
|
||||
});
|
||||
|
|
|
@ -46,9 +46,9 @@ const server = tls.Server(options, common.mustCall(function(socket) {
|
|||
|
||||
let recvCount = 0;
|
||||
|
||||
server.listen(common.PORT, function() {
|
||||
server.listen(0, function() {
|
||||
const client = tls.connect({
|
||||
port: common.PORT,
|
||||
port: server.address().port,
|
||||
rejectUnauthorized: false
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue