Skip to content

Commit

Permalink
test: check crypto before requiring tls module
Browse files Browse the repository at this point in the history
test-tls-session-cache currently fails if built --without-ssl:
internal/util.js:82
    throw new errors.Error('ERR_NO_CRYPTO');
    ^

Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto
support
    at Object.assertCrypto (internal/util.js:82:11)
    at tls.js:26:14
    at NativeModule.compile (bootstrap_node.js:586:7)
    at Function.NativeModule.require (bootstrap_node.js:531:18)
    at Function.Module._load (module.js:449:25)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous>
(/node/test/parallel/test-tls-session-cache.js:26:13)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)

The test has a crypto check but it come after the require of the tls
module.

This commit moves the crypto check to come before the require of tls and
allows the test to pass.

PR-URL: #14708
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: David Cai <davidcai1993@yahoo.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
danbev authored and MylesBorins committed Sep 20, 2017
1 parent 68cf7f0 commit 32260b9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/parallel/test-tls-session-cache.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict';
const common = require('../common');

if (!common.opensslCli)
common.skip('node compiled without OpenSSL CLI.');

if (!common.hasCrypto)
common.skip('missing crypto');

if (!common.opensslCli)
common.skip('node compiled without OpenSSL CLI.');

const assert = require('assert');
const tls = require('tls');
const fs = require('fs');
Expand Down

0 comments on commit 32260b9

Please sign in to comment.