test: refactor test-tls-env-extra-ca
* Use `common.mustCall()` to guarantee callback invocations * Order modules according to test writing guide PR-URL: https://github.com/nodejs/node/pull/13886 Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
parent
d71d7a1bc7
commit
062c414f5c
@ -9,18 +9,19 @@ if (!common.hasCrypto) {
|
||||
}
|
||||
|
||||
const assert = require('assert');
|
||||
const tls = require('tls');
|
||||
const fork = require('child_process').fork;
|
||||
const fs = require('fs');
|
||||
const tls = require('tls');
|
||||
|
||||
const fork = require('child_process').fork;
|
||||
|
||||
if (process.env.CHILD) {
|
||||
const copts = {
|
||||
port: process.env.PORT,
|
||||
checkServerIdentity: common.noop,
|
||||
checkServerIdentity: common.mustCall(),
|
||||
};
|
||||
const client = tls.connect(copts, function() {
|
||||
const client = tls.connect(copts, common.mustCall(function() {
|
||||
client.end('hi');
|
||||
});
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -29,10 +30,10 @@ const options = {
|
||||
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
|
||||
};
|
||||
|
||||
const server = tls.createServer(options, function(s) {
|
||||
const server = tls.createServer(options, common.mustCall(function(s) {
|
||||
s.end('bye');
|
||||
server.close();
|
||||
}).listen(0, common.mustCall(function() {
|
||||
})).listen(0, common.mustCall(function() {
|
||||
const env = {
|
||||
CHILD: 'yes',
|
||||
PORT: this.address().port,
|
||||
|
Loading…
x
Reference in New Issue
Block a user