Skip to content

Commit

Permalink
tests: add test to sanity-check Amazon CAs
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Nov 12, 2019
1 parent e81cdc7 commit 673992d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions test/unit/test-ConnectionConfig.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var common = require('../common');
var Crypto = require('crypto');
var test = require('utest');
var assert = require('assert');
var ConnectionConfig = common.ConnectionConfig;
Expand Down Expand Up @@ -168,13 +169,24 @@ test('ConnectionConfig#Constructor.ssl', {
assert.equal(config.ssl, false);
},

'string loads pre-defined profile': function() {
'string "Amazon RDS" loads valid profile': function() {
var config = new ConnectionConfig({
ssl: 'Amazon RDS'
});

assert.ok(config.ssl);
assert.ok(/-----BEGIN CERTIFICATE-----/.test(config.ssl.ca));
assert.ok(Array.isArray(config.ssl.ca));

config.ssl.ca.forEach(function (ca) {
assert.equal(typeof ca, 'string', 'ca is a string');

if (Crypto.createPublicKey) {
var key = null;

assert.doesNotThrow(function () { key = Crypto.createPublicKey(ca); });
assert.equal(key.type, 'public');
}
});
},

'throws on unknown profile name': function() {
Expand Down

0 comments on commit 673992d

Please sign in to comment.