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: dynamic port in parallel regress tests #12639

Closed
wants to merge 1 commit into from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions test/parallel/test-regress-GH-5051.js
Expand Up @@ -12,20 +12,22 @@ agent.maxSockets = 0;

// localAddress is used when naming requests / sockets
// while using the Legacy API
agent.addRequest(req, 'localhost', common.PORT, '127.0.0.1');
// port 8080 is hardcoded since this does not create a network connection
agent.addRequest(req, 'localhost', 8080, '127.0.0.1');
assert.strictEqual(Object.keys(agent.requests).length, 1);
assert.strictEqual(
Object.keys(agent.requests)[0],
'localhost:' + common.PORT + ':127.0.0.1');
'localhost:8080:127.0.0.1');

// path is *not* used when naming requests / sockets
// port 8080 is hardcoded since this does not create a network connection
agent.addRequest(req, {
host: 'localhost',
port: common.PORT,
port: 8080,
localAddress: '127.0.0.1',
path: '/foo'
});
assert.strictEqual(Object.keys(agent.requests).length, 1);
assert.strictEqual(
Object.keys(agent.requests)[0],
'localhost:' + common.PORT + ':127.0.0.1');
'localhost:8080:127.0.0.1');
4 changes: 2 additions & 2 deletions test/parallel/test-regress-GH-5727.js
Expand Up @@ -6,9 +6,9 @@ const net = require('net');
const invalidPort = -1 >>> 0;
const errorMessage = /"port" argument must be >= 0 and < 65536/;

net.Server().listen(common.PORT, function() {
net.Server().listen(0, function() {
const address = this.address();
const key = `${address.family.slice(-1)}:${address.address}:${common.PORT}`;
const key = `${address.family.slice(-1)}:${address.address}:0`;

assert.strictEqual(this._connectionKey, key);
this.close();
Expand Down