Skip to content

test: fix test-tls-env-extra-ca-file-load #32073

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

Closed
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
17 changes: 9 additions & 8 deletions test/parallel/test-tls-env-extra-ca-file-load.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,7 @@ const { fork } = require('child_process');

// This test ensures that extra certificates are loaded at startup.
if (process.argv[2] !== 'child') {
if (process.env.CHILD_USE_EXTRA_CA_CERTS === 'yes') {
assert.strictEqual(binding.isExtraRootCertsFileLoaded(), true);
} else if (process.env.CHILD_USE_EXTRA_CA_CERTS === 'no') {
assert.strictEqual(binding.isExtraRootCertsFileLoaded(), false);
tls.createServer({});
assert.strictEqual(binding.isExtraRootCertsFileLoaded(), false);
}
} else {
// Parent
const NODE_EXTRA_CA_CERTS = fixtures.path('keys', 'ca1-cert.pem');
const extendsEnv = (obj) => ({ ...process.env, ...obj });

Expand All @@ -37,4 +30,12 @@ if (process.argv[2] !== 'child') {
assert.strictEqual(status, 0);
}));
});
} else if (process.env.CHILD_USE_EXTRA_CA_CERTS === 'yes') {
// Child with extra certificates loaded at startup.
assert.strictEqual(binding.isExtraRootCertsFileLoaded(), true);
} else {
// Child without extra certificates.
assert.strictEqual(binding.isExtraRootCertsFileLoaded(), false);
tls.createServer({});
assert.strictEqual(binding.isExtraRootCertsFileLoaded(), false);
}