Skip to content

Commit d53bcea

Browse files
ebickleaddaleax
authored andcommitted
test: fix test-tls-env-extra-ca-file-load
Fixes broken unit test for the NODE_EXTRA_CA_CERTS environment variable. Unit test was exiting without evaluating any assertions or running any tests. Fixes: #32072 PR-URL: #32073 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent b1a13b1 commit d53bcea

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/parallel/test-tls-env-extra-ca-file-load.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,7 @@ const { fork } = require('child_process');
1616

1717
// This test ensures that extra certificates are loaded at startup.
1818
if (process.argv[2] !== 'child') {
19-
if (process.env.CHILD_USE_EXTRA_CA_CERTS === 'yes') {
20-
assert.strictEqual(binding.isExtraRootCertsFileLoaded(), true);
21-
} else if (process.env.CHILD_USE_EXTRA_CA_CERTS === 'no') {
22-
assert.strictEqual(binding.isExtraRootCertsFileLoaded(), false);
23-
tls.createServer({});
24-
assert.strictEqual(binding.isExtraRootCertsFileLoaded(), false);
25-
}
26-
} else {
19+
// Parent
2720
const NODE_EXTRA_CA_CERTS = fixtures.path('keys', 'ca1-cert.pem');
2821
const extendsEnv = (obj) => ({ ...process.env, ...obj });
2922

@@ -37,4 +30,12 @@ if (process.argv[2] !== 'child') {
3730
assert.strictEqual(status, 0);
3831
}));
3932
});
33+
} else if (process.env.CHILD_USE_EXTRA_CA_CERTS === 'yes') {
34+
// Child with extra certificates loaded at startup.
35+
assert.strictEqual(binding.isExtraRootCertsFileLoaded(), true);
36+
} else {
37+
// Child without extra certificates.
38+
assert.strictEqual(binding.isExtraRootCertsFileLoaded(), false);
39+
tls.createServer({});
40+
assert.strictEqual(binding.isExtraRootCertsFileLoaded(), false);
4041
}

0 commit comments

Comments
 (0)