Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: refactor test-tls-env-extra-ca #13886

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also be reordered?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put it separate from the rest because of the .fork appended to the end. I think our test writing guidelines might be ambiguous on this situation. ¯\(ツ)

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