Files
node/test/parallel/test-tls-off-thread-cert-loading-system.js
Joyee Cheung 6432765a9c src: fix off-thread cert loading in bundled cert mode
https://redirect.github.com/nodejs/node/pull/59856 had an typo/mistake
in the skip conditions so that it is skipping when --use-openssl-ca
or --openssl-system-ca-path (configure time) are NOT used, even
though they should be skipped only when those ARE used (which is
not the default for default builds). This change fixes that so
that the perf numbers in that PR is true for the default build.

PR-URL: https://github.com/nodejs/node/pull/60764
Reviewed-By: Aditi Singh <aditisingh1400@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-12-02 09:51:06 +00:00

57 lines
1.5 KiB
JavaScript

'use strict';
// This test verifies that system root certificates loading is loaded off-thread if
// --use-system-ca is used.
const common = require('../common');
if (!common.hasCrypto) {
common.skip('missing crypto');
}
const tmpdir = require('../common/tmpdir');
const { spawnSyncAndAssert } = require('../common/child_process');
const fixtures = require('../common/fixtures');
const assert = require('assert');
const { writeCerts } = require('../common/tls');
const tls = require('tls');
tmpdir.refresh();
writeCerts([
// Check that the extra cert is loaded.
fixtures.readKey('fake-startcom-root-cert.pem'),
// Check that the system certs are loaded.
...tls.getCACertificates('system'),
// Check that the bundled certs are loaded.
...tls.getCACertificates('bundled'),
], tmpdir.resolve('check-cert.pem'));
spawnSyncAndAssert(
process.execPath,
[ '--use-system-ca', '--use-bundled-ca', fixtures.path('list-certs.js') ],
{
env: {
...process.env,
NODE_DEBUG_NATIVE: 'crypto',
NODE_EXTRA_CA_CERTS: fixtures.path('keys', 'fake-startcom-root-cert.pem'),
EXPECTED_CERTS_PATH: tmpdir.resolve('check-cert.pem'),
CERTS_TYPE: 'default',
}
},
{
stderr(output) {
assert.match(
output,
/Started loading bundled root certificates off-thread/
);
assert.match(
output,
/Started loading extra root certificates off-thread/
);
assert.match(
output,
/Started loading system root certificates off-thread/
);
return true;
}
}
);