-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: add --use-bundled-ca --use-openssl-ca check
The --use-bundled-ca and --use-openssl-ca command line arguments are mutually exclusive but can both be used on the same command line. This commit adds a check if both options are used. Fixes: #12083 Backport-PR-URL: #17783 PR-URL: #12087 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
- Loading branch information
1 parent
d00728e
commit 6d291ef
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
// This test checks the usage of --use-bundled-ca and --use-openssl-ca arguments | ||
// to verify that both are not used at the same time. | ||
const common = require('../common'); | ||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
|
||
const assert = require('assert'); | ||
const os = require('os'); | ||
const childProcess = require('child_process'); | ||
const result = childProcess.spawnSync( | ||
process.execPath, | ||
[ '--use-bundled-ca', '--use-openssl-ca', '-p', 'process.version' ], | ||
{ encoding: 'utf8' } | ||
); | ||
|
||
assert.strictEqual(result.stderr, `${process.execPath | ||
}: either --use-openssl-ca or --use-bundled-ca can be used, not both${os.EOL}` | ||
); | ||
assert.strictEqual(result.status, 9); | ||
|
||
const useBundledCA = childProcess.spawnSync(process.execPath, [ | ||
'--use-bundled-ca', | ||
'-p', 'process.version']); | ||
assert.strictEqual(useBundledCA.status, 0); | ||
|
||
const useOpenSSLCA = childProcess.spawnSync(process.execPath, [ | ||
'--use-openssl-ca', | ||
'-p', 'process.version']); | ||
assert.strictEqual(useOpenSSLCA.status, 0); |