Skip to content

Commit

Permalink
test: refactor test-tls-env-extra-ca
Browse files Browse the repository at this point in the history
* Use `common.mustCall()` to guarantee callback invocations
* Order modules according to test writing guide

PR-URL: #13886
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
  • Loading branch information
Trott authored and addaleax committed Jul 18, 2017
1 parent 12b6765 commit a767367
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/parallel/test-tls-env-extra-ca.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ if (!common.hasCrypto) {
}

const assert = require('assert');
const fs = require('fs');
const tls = require('tls');

const fork = require('child_process').fork;
const fs = require('fs');

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;
}

Expand All @@ -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,
Expand Down

0 comments on commit a767367

Please sign in to comment.