Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove common.PORT from some pummel tests #31749

Merged
merged 4 commits into from
Feb 18, 2020
Merged
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
6 changes: 3 additions & 3 deletions test/pummel/test-net-pause.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
const common = require('../common');
require('../common');
const assert = require('assert');
const net = require('net');

Expand All @@ -43,7 +43,7 @@ const server = net.createServer((connection) => {
});

server.on('listening', () => {
const client = net.createConnection(common.PORT);
const client = net.createConnection(server.address().port);
client.setEncoding('ascii');
client.on('data', (d) => {
console.log(d);
Expand Down Expand Up @@ -83,7 +83,7 @@ server.on('listening', () => {
client.end();
});
});
server.listen(common.PORT);
server.listen(0);

process.on('exit', () => {
assert.strictEqual(recv.length, N);
Expand Down
10 changes: 5 additions & 5 deletions test/pummel/test-net-throttle.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
const common = require('../common');
require('../common');
const assert = require('assert');
const net = require('net');

Expand All @@ -32,8 +32,6 @@ let npauses = 0;
console.log('build big string');
const body = 'C'.repeat(N);

console.log(`start server on port ${common.PORT}`);

const server = net.createServer((connection) => {
connection.write(body.slice(0, part_N));
connection.write(body.slice(part_N, 2 * part_N));
Expand All @@ -44,9 +42,11 @@ const server = net.createServer((connection) => {
connection.end();
});

server.listen(common.PORT, () => {
server.listen(0, () => {
const port = server.address().port;
console.log(`server started on port ${port}`);
let paused = false;
const client = net.createConnection(common.PORT);
const client = net.createConnection(port);
client.setEncoding('ascii');
client.on('data', (d) => {
chars_recved += d.length;
Expand Down
9 changes: 5 additions & 4 deletions test/pummel/test-net-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
const common = require('../common');
require('../common');
const assert = require('assert');
const net = require('net');

Expand Down Expand Up @@ -54,10 +54,11 @@ const echo_server = net.createServer((socket) => {
});
});

echo_server.listen(common.PORT, () => {
console.log(`server listening at ${common.PORT}`);
echo_server.listen(0, () => {
const port = echo_server.address().port;
console.log(`server listening at ${port}`);

const client = net.createConnection(common.PORT);
const client = net.createConnection(port);
client.setEncoding('UTF8');
client.setTimeout(0); // Disable the timeout for client
client.on('connect', () => {
Expand Down
4 changes: 2 additions & 2 deletions test/pummel/test-tls-server-large-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ const server = tls.Server(options, common.mustCall(function(socket) {
socket.pipe(mediator);
}));

server.listen(common.PORT, common.mustCall(function() {
server.listen(0, common.mustCall(() => {
const client1 = tls.connect({
port: common.PORT,
port: server.address().port,
rejectUnauthorized: false
}, common.mustCall(function() {
client1.end(request);
Expand Down