Skip to content

Commit

Permalink
test: remove unnecessary use of common.PORT in addons test
Browse files Browse the repository at this point in the history
Using port 0 to request an open port from the operating system is
sufficient in openssl-client-cert-engine/test.js.

PR-URL: #17563
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
Trott committed Dec 12, 2017
1 parent 800ce94 commit ba9801a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions test/addons/openssl-client-cert-engine/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ const agentKey = fs.readFileSync(fixture.path('/keys/agent1-key.pem'));
const agentCert = fs.readFileSync(fixture.path('/keys/agent1-cert.pem'));
const agentCa = fs.readFileSync(fixture.path('/keys/ca1-cert.pem'));

const port = common.PORT;

const serverOptions = {
key: agentKey,
cert: agentCert,
Expand All @@ -34,11 +32,11 @@ const serverOptions = {
const server = https.createServer(serverOptions, (req, res) => {
res.writeHead(200);
res.end('hello world');
}).listen(port, common.localhostIPv4, () => {
}).listen(0, common.localhostIPv4, () => {
const clientOptions = {
method: 'GET',
host: common.localhostIPv4,
port: port,
port: server.address().port,
path: '/test',
clientCertEngine: engine, // engine will provide key+cert
rejectUnauthorized: false, // prevent failing on self-signed certificates
Expand Down

0 comments on commit ba9801a

Please sign in to comment.