test: configure certs in tests

OpenSSL 1.1.0 disables anonymous ciphers unless building with
enable-weak-crypto. Avoid unnecessary dependencies on these ciphers in
tests.

PR-URL: https://github.com/nodejs/node/pull/16130
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rod Vagg <rod@vagg.org>
This commit is contained in:
David Benjamin 2017-09-23 03:40:42 -04:00 committed by Rod Vagg
parent f7410405e4
commit e433afa652
2 changed files with 10 additions and 6 deletions

View File

@ -7,12 +7,15 @@ if (!common.hasIPv6)
common.skip('no IPv6 support');
const assert = require('assert');
const fixtures = require('../common/fixtures');
const https = require('https');
const dns = require('dns');
function runTest() {
const ciphers = 'AECDH-NULL-SHA';
https.createServer({ ciphers }, common.mustCall(function(req, res) {
https.createServer({
cert: fixtures.readKey('agent1-cert.pem'),
key: fixtures.readKey('agent1-key.pem'),
}, common.mustCall(function(req, res) {
this.close();
res.end();
})).listen(0, '::1', common.mustCall(function() {
@ -20,7 +23,6 @@ function runTest() {
host: 'localhost',
port: this.address().port,
family: 6,
ciphers: ciphers,
rejectUnauthorized: false,
};
// Will fail with ECONNREFUSED if the address family is not honored.

View File

@ -7,19 +7,21 @@ if (!common.hasIPv6)
common.skip('no IPv6 support');
const assert = require('assert');
const fixtures = require('../common/fixtures');
const tls = require('tls');
const dns = require('dns');
function runTest() {
const ciphers = 'AECDH-NULL-SHA';
tls.createServer({ ciphers }, common.mustCall(function() {
tls.createServer({
cert: fixtures.readKey('agent1-cert.pem'),
key: fixtures.readKey('agent1-key.pem'),
}, common.mustCall(function() {
this.close();
})).listen(0, '::1', common.mustCall(function() {
const options = {
host: 'localhost',
port: this.address().port,
family: 6,
ciphers: ciphers,
rejectUnauthorized: false,
};
// Will fail with ECONNREFUSED if the address family is not honored.