test: replace common.fixturesDir with readKey
PR-URL: https://github.com/nodejs/node/pull/15946 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
parent
2b5b423dff
commit
86d803b385
@ -1,13 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
|
const fixtures = require('../common/fixtures');
|
||||||
|
|
||||||
if (!common.hasCrypto)
|
if (!common.hasCrypto)
|
||||||
common.skip('missing crypto');
|
common.skip('missing crypto');
|
||||||
|
|
||||||
const { strictEqual } = require('assert');
|
const { strictEqual } = require('assert');
|
||||||
const { join } = require('path');
|
|
||||||
const { readFileSync } = require('fs');
|
|
||||||
const { createSecureContext } = require('tls');
|
const { createSecureContext } = require('tls');
|
||||||
const { createSecureServer, connect } = require('http2');
|
const { createSecureServer, connect } = require('http2');
|
||||||
const { get } = require('https');
|
const { get } = require('https');
|
||||||
@ -16,13 +15,9 @@ const { connect: tls } = require('tls');
|
|||||||
|
|
||||||
const countdown = (count, done) => () => --count === 0 && done();
|
const countdown = (count, done) => () => --count === 0 && done();
|
||||||
|
|
||||||
function loadKey(keyname) {
|
const key = fixtures.readKey('agent8-key.pem');
|
||||||
return readFileSync(join(common.fixturesDir, 'keys', keyname));
|
const cert = fixtures.readKey('agent8-cert.pem');
|
||||||
}
|
const ca = fixtures.readKey('fake-startcom-root-cert.pem');
|
||||||
|
|
||||||
const key = loadKey('agent8-key.pem');
|
|
||||||
const cert = loadKey('agent8-cert.pem');
|
|
||||||
const ca = loadKey('fake-startcom-root-cert.pem');
|
|
||||||
|
|
||||||
const clientOptions = { secureContext: createSecureContext({ ca }) };
|
const clientOptions = { secureContext: createSecureContext({ ca }) };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user