Skip to content

Commit 41b65b9

Browse files
forivallgibfahn
authored andcommitted
test: use common.fixtures in checkServerIdentity
PR-URL: #15951 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
1 parent b3a8bf3 commit 41b65b9

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
@@ -25,13 +25,12 @@ if (!common.hasCrypto)
2525
common.skip('missing crypto');
2626

2727
const assert = require('assert');
28+
const fixtures = require('../common/fixtures');
2829
const https = require('https');
29-
const fs = require('fs');
30-
const path = require('path');
3130

3231
const options = {
33-
key: fs.readFileSync(path.join(common.fixturesDir, 'keys/agent3-key.pem')),
34-
cert: fs.readFileSync(path.join(common.fixturesDir, 'keys/agent3-cert.pem'))
32+
key: fixtures.readKey('agent3-key.pem'),
33+
cert: fixtures.readKey('agent3-cert.pem')
3534
};
3635

3736
const server = https.createServer(options, common.mustCall(function(req, res) {
@@ -46,7 +45,7 @@ function authorized() {
4645
const req = https.request({
4746
port: server.address().port,
4847
rejectUnauthorized: true,
49-
ca: [fs.readFileSync(path.join(common.fixturesDir, 'keys/ca2-cert.pem'))]
48+
ca: [fixtures.readKey('ca2-cert.pem')]
5049
}, common.mustNotCall());
5150
req.on('error', function(err) {
5251
override();
@@ -58,7 +57,7 @@ function override() {
5857
const options = {
5958
port: server.address().port,
6059
rejectUnauthorized: true,
61-
ca: [fs.readFileSync(path.join(common.fixturesDir, 'keys/ca2-cert.pem'))],
60+
ca: [fixtures.readKey('ca2-cert.pem')],
6261
checkServerIdentity: function(host, cert) {
6362
return false;
6463
}

0 commit comments

Comments
 (0)