Skip to content

Commit 48a55d1

Browse files
forivallMylesBorins
authored andcommitted
test: use common.fixtures in checkServerIdentity
PR-URL: #15951 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent 909e587 commit 48a55d1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

test/parallel/test-https-client-checkServerIdentity.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ if (!common.hasCrypto)
44
common.skip('missing crypto');
55

66
const assert = require('assert');
7+
const fixtures = require('../common/fixtures');
78
const https = require('https');
8-
const fs = require('fs');
9-
const path = require('path');
109

1110
const options = {
12-
key: fs.readFileSync(path.join(common.fixturesDir, 'keys/agent3-key.pem')),
13-
cert: fs.readFileSync(path.join(common.fixturesDir, 'keys/agent3-cert.pem'))
11+
key: fixtures.readKey('agent3-key.pem'),
12+
cert: fixtures.readKey('agent3-cert.pem')
1413
};
1514

1615
const server = https.createServer(options, common.mustCall(function(req, res) {
@@ -25,7 +24,7 @@ function authorized() {
2524
const req = https.request({
2625
port: server.address().port,
2726
rejectUnauthorized: true,
28-
ca: [fs.readFileSync(path.join(common.fixturesDir, 'keys/ca2-cert.pem'))]
27+
ca: [fixtures.readKey('ca2-cert.pem')]
2928
}, common.mustNotCall());
3029
req.on('error', function(err) {
3130
override();
@@ -37,7 +36,7 @@ function override() {
3736
const options = {
3837
port: server.address().port,
3938
rejectUnauthorized: true,
40-
ca: [fs.readFileSync(path.join(common.fixturesDir, 'keys/ca2-cert.pem'))],
39+
ca: [fixtures.readKey('ca2-cert.pem')],
4140
checkServerIdentity: function(host, cert) {
4241
return false;
4342
}

0 commit comments

Comments
 (0)