Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
test: test precedence order in test-tls-cipher-list
Browse files Browse the repository at this point in the history
Per feedback from Julian, test the order of precedence
on the command line switches and environment variables
  • Loading branch information
jasnell committed Apr 22, 2015
1 parent c6e1a88 commit 0f02481
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/simple/test-tls-cipher-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,21 @@ function doTest(checklist, env, useswitch) {
// Test NODE_LEGACY_CIPHER_LIST
if (env) options = {env:{"NODE_LEGACY_CIPHER_LIST": env}};
break;
case 4:
// Test NODE_CIPHER_LIST takes precedence over --cipher-list
args.unshift('--cipher-list=XYZ');
if (env) options = {env:{"NODE_CIPHER_LIST": env}};
break;
case 5:
// Test --enable-legacy-cipher-list takes precedence over --cipher-list
args.unshift('--cipher-list=XYZ');
args.unshift('--enable-legacy-cipher-list=' + env);
break;
case 6:
// Test NODE_LEGACY_CIPHER_LIST takes precendence over --cipher-list
args.unshift('--cipher-list=XYZ');
if (env) options = {env:{"NODE_LEGACY_CIPHER_LIST": env}};
break;
default:
// Test NODE_CIPHER_LIST
if (env) options = {env:env};
Expand All @@ -63,6 +78,9 @@ function doTest(checklist, env, useswitch) {
doTest(crypto.DEFAULT_CIPHER_LIST); // test the default
doTest('ABC', {'NODE_CIPHER_LIST':'ABC'}); // test the envar
doTest('ABC', 'ABC', 1); // test the --cipher-list switch
doTest('ABC', 'ABC', 4);
doTest(tls.getLegacyCiphers('v0.10.38'), 'v0.10.38', 5);
doTest(tls.getLegacyCiphers('v0.10.38'), 'v0.10.38', 6);

['v0.10.38'].forEach(function(ver) {
doTest(tls.getLegacyCiphers(ver), ver, 2);
Expand Down

0 comments on commit 0f02481

Please sign in to comment.