test: remove unnecessary use of common.PORT in addons test
Using port 0 to request an open port from the operating system is sufficient in openssl-client-cert-engine/test.js. PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
800ce94e5c
commit
ba9801a8d2
@ -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 agentCert = fs.readFileSync(fixture.path('/keys/agent1-cert.pem'));
|
||||||
const agentCa = fs.readFileSync(fixture.path('/keys/ca1-cert.pem'));
|
const agentCa = fs.readFileSync(fixture.path('/keys/ca1-cert.pem'));
|
||||||
|
|
||||||
const port = common.PORT;
|
|
||||||
|
|
||||||
const serverOptions = {
|
const serverOptions = {
|
||||||
key: agentKey,
|
key: agentKey,
|
||||||
cert: agentCert,
|
cert: agentCert,
|
||||||
@ -34,11 +32,11 @@ const serverOptions = {
|
|||||||
const server = https.createServer(serverOptions, (req, res) => {
|
const server = https.createServer(serverOptions, (req, res) => {
|
||||||
res.writeHead(200);
|
res.writeHead(200);
|
||||||
res.end('hello world');
|
res.end('hello world');
|
||||||
}).listen(port, common.localhostIPv4, () => {
|
}).listen(0, common.localhostIPv4, () => {
|
||||||
const clientOptions = {
|
const clientOptions = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
host: common.localhostIPv4,
|
host: common.localhostIPv4,
|
||||||
port: port,
|
port: server.address().port,
|
||||||
path: '/test',
|
path: '/test',
|
||||||
clientCertEngine: engine, // engine will provide key+cert
|
clientCertEngine: engine, // engine will provide key+cert
|
||||||
rejectUnauthorized: false, // prevent failing on self-signed certificates
|
rejectUnauthorized: false, // prevent failing on self-signed certificates
|
||||||
|
Loading…
x
Reference in New Issue
Block a user